Math
Buffon's needle
Estimate π by throwing random needles across parallel lines, compare sample sizes and track a statistical uncertainty interval.

Try this
Needle centres and directions are sampled uniformly. Gold needles cross a parallel line. For length no greater than spacing, the crossing frequency estimates π. The displayed interval comes from a Wilson binomial interval transformed to π; only the last 220 needles are drawn.
Equations used in the module
Equations For 0 < L ≤ d: P(crossing) = 2L/(πd) πestimate = 2L N/(d C) Directions are uniform in [0,π); centre height is uniform modulo d Sampling error decreases on the order of 1/√N


