Anonymous user
Monte Carlo methods: Difference between revisions
Updated to work with Nim 1.4: added missing parameter type, added "import random", changed "random" to "rand".
m (→{{header|REXX}}: added a true link to the post output section.) |
(Updated to work with Nim 1.4: added missing parameter type, added "import random", changed "random" to "rand".) |
||
Line 1,721:
=={{header|Nim}}==
<lang nim>import math, random
randomize()
proc pi(nthrows: float): float =
var inside = 0.0
for i in 1..int64(nthrows):
if hypot(
for n in [10e4, 10e6, 10e7, 10e8]:
echo pi(n)</lang>
|