About this app
Imagine a sheet of paper marked with equally spaced parallel lines. Now take a needle whose length equals the distance between neighboring lines and drop it at random. It can be shown that the probability of the needle crossing a line is 2/π. If we repeat the experiment many times, the fraction of needles that cross a line approaches 2/π. We can therefore estimate pi by dividing 2 by this hit ratio. Buffon's Needle is an example of a Monte Carlo simulation, a method that uses repeated random trials to estimate a numerical value.
Press the 'Drop Needle' button to release one needle, or hold it down to drop needles continuously. Green needles cross a line, while red needles do not. The center of each needle is placed randomly inside the dashed rectangle, which keeps every needle on the board. This does not change the crossing probability because the rectangle spans a whole number of line spacings, and the needle centers and angles are still chosen uniformly at random. Press the 'Reset' button to clear the board and start again.