Presets
Playback
Estimator and generator
Layers
Model check
The science
The idea
Throw random points into the square [-1,1]2. The share that lands inside the unit circle is the area ratio p = π/4, so π ≈ 4 Nin/N. In 3D the unit sphere fills π/6 of the cube, so π ≈ 6 Nin/N.
How fast does it converge?
The count of points inside is binomial, so π-hat has standard error c √(p(1-p)/N) with c = 4 (2D) or 6 (3D): about 1.64/√N in 2D. The error therefore shrinks like N-1/2: one more digit costs 100 times more points. A 95 % interval is ±1.96 standard errors.
Better point sets
Quasi-random Halton points (radical inverses in bases 2, 3, 5) fill the square more evenly and give errors of order (log N)d/N for smooth integrands; the circle's edge is not smooth, so the gain is real but modest. Stratified sampling places one jittered point in each cell of a 32 x 32 grid (8 x 8 x 8 in 3D) and removes the clumping of pure random points. All three generators run side by side so that you can compare them in the same graph.
Buffon's needle
A needle of length L thrown on lines spaced d ≥ L crosses a line with probability 2L/(π d), so π ≈ 2 L N / (d H) after H crossings in N throws. The estimator is noisier than darts because it divides by a count.
Honest simplifications
The pseudo-random numbers come from a small deterministic generator (mulberry32), not a physical source. The Gaussian drawn over the repeated experiments is the central-limit approximation. The Halton and stratified repeats use random shifts or random cells so that their spread can be measured; their errors do not follow the pseudo-random formula. Educational model.
Model checks in this page
(1) the spread of 400 pseudo-random runs matches c √(p(1-p)/N); (2) Halton at N = 4096 beats that standard error; (3) the Buffon crossing probability from numerical integration equals 2L/(π d).