Monte Carlo methods: Difference between revisions

Content added Content deleted
No edit summary
(Added 11l)
Line 27: Line 27:
3.141592653589793238462643383280
3.141592653589793238462643383280
<br><br>
<br><br>

=={{header|11l}}==
<lang 11l>F monte_carlo_pi(n)
V inside = 0
L 1..n
V x = random:()
V y = random:()
I x * x + y * y <= 1
inside++
R 4.0 * inside / n

print(monte_carlo_pi(1000000))</lang>

{{out}}
<pre>
3.13775
</pre>


=={{header|360 Assembly}}==
=={{header|360 Assembly}}==