10 lines
189 B
Text
10 lines
189 B
Text
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))
|