Monte Cristo

A playground for Monte Carlo simulations.

π ≈ 4 · NinNtotal
4 · 00
0.0000000
target: 3.1415927
Points simulated: 0

How it works

Random points land inside a square enclosing a circle. The probability of a point landing inside the circle equals the ratio of their areas (π/4). As the point count grows, our estimate converges on π.

Reality check

Monte Carlo error scales with 1/√N. Adding one decimal place of accuracy takes one hundred times more points. This is a terrible way to find π, but a vivid way to see how Monte Carlo convergence works.