Take a pile of matches and a floor made of wooden planks. Toss the matches at random, and count how many land touching a crack between planks. That count secretly contains the number π. In 1733 the French naturalist Georges-Louis Leclerc, Comte de Buffon, posed this puzzle, and its answer is one of the strangest ways ever found to pin down π.
Below, the grey lines are the cracks between planks, spaced d apart. Each needle has length l. Lime needles touch a line; grey ones don't. Press a button and watch the estimate settle.
A needle's position doesn't matter much. What matters is how far its centre lies from the nearest line, and how tilted it is. A needle lying parallel to the lines barely ever crosses one. A needle standing square to the lines crosses easily. Averaging over every possible tilt brings in the sine of the angle, and averaging a sine over half a turn is where the circle sneaks in.
The result, for a needle no longer than the spacing, is clean: the chance of touching a line is 2l / (πd). Rearranged, π ≈ 2l × (needles dropped) / (d × (needles touching)). That's exactly the number the page computes.
There is a slicker way to see it. The chance of crossing is proportional to the needle's length: a needle twice as long gives, on average, twice as many crossings. This holds for any shape, so a bent wire or a loose curl of thread gives the same average crossings per unit length. Now choose a circle whose diameter equals the line spacing. It always crosses lines exactly twice, and its length is πd. So the average crossings per unit length is 2/(πd), and a straight needle of length l averages 2l/(πd). Same answer, no calculus.
Try it yourself: after 1000 drops the estimate is often within a couple of percent, but it wanders. Real accuracy grows slowly, since random error shrinks only with the square root of the number of drops. Getting each extra digit of π costs about a hundred times more needles. Nobody should compute π this way. The point is that pure chance, with no circle in sight, knows about circles.
A famous cautionary tale: in 1901 an Italian mathematician named Lazzarini reported 3408 tosses giving 355/113, which is π correct to six decimal places. That is much luckier than chance allows. With a needle 5/6 the line spacing, it needs exactly 1808 crossings, and 3408 is a number you can pick in advance to make the fraction work. Most historians suspect the result was arranged rather than random.
Slide the needle to its shortest and drop 1000. Fewer needles touch, so each touch carries more weight and the estimate gets noisier. Then try the longest needle, equal to the spacing. Does it settle faster? The very idea, using random sampling to compute a fixed number, is the seed of what later became the Monte Carlo method.