15 lines
227 B
Text
15 lines
227 B
Text
func mc n .
|
|
for i = 1 to n
|
|
x = randomf
|
|
y = randomf
|
|
if x * x + y * y < 1
|
|
hit += 1
|
|
.
|
|
.
|
|
return 4.0 * hit / n
|
|
.
|
|
numfmt 4 0
|
|
print mc 10000
|
|
print mc 100000
|
|
print mc 1000000
|
|
print mc 10000000
|