This code is still running...Let's wait for a billion. And biggest integer 2.1 billion.
Wait...
10 pi = 1.6
30 pi = 2.4
100 pi = 2.84
1000 pi = 3.12
10000 pi = 3.1452
40000 pi = 3.1289
100000 pi = 3.13792
1000000 pi = 3.142644
rebol[]
random/seed now/precise
amounts: [10 30 100 1000 10000 40000 100000 1000000 1e+9 2147483647]
InCircle: 0
number: length? amounts
points: 0
ind: 1
print "Wait..."
until [
x: (random 100000) / 100000
y: (random 100000) / 100000
if ((x * x) + (y * y)) <= 1 [
InCircle: InCircle + 1
]
points: points + 1
if find amounts points [
print [points " pi = " 4 * (InCircle / amounts/(ind))]
ind: ind + 1
]
points = amounts/(number)
]
halt
If we put randomly plots to a 2x2 square where is circle which radius is 1 we can count pi. It is the amounts of points in circle multiplied 4 divided the number of all points because area of circle is pi*r^2=pi and area of square is 4.