Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Monte-Carlo-methods/Ring/monte-carlo-methods.ring
Normal file
12
Task/Monte-Carlo-methods/Ring/monte-carlo-methods.ring
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
decimals(8)
|
||||
see "monteCarlo(1000) = " + monteCarlo(1000) + nl
|
||||
see "monteCarlo(10000) = " + monteCarlo(10000) + nl
|
||||
see "monteCarlo(100000) = " + monteCarlo(100000) + nl
|
||||
|
||||
func monteCarlo t
|
||||
n=0
|
||||
for i = 1 to t
|
||||
if sqrt(pow(random(1),2) + pow(random(1),2)) <= 1 n += 1 ok
|
||||
next
|
||||
t = (4 * n) / t
|
||||
return t
|
||||
Loading…
Add table
Add a link
Reference in a new issue