Java Number Cruncher
Monte Carlo and Buffon's Needles
This applet demonstrates a Monte Carlo algorithm, Button's needles. Needles of length 1 are dropped randomly onto a sheet of paper ruled with parallel lines 1 unit apart. The ratio of the number of needles that cross a line to the total number of needles approaches 2/pi, from which we can compute the value of pi.
To run the demo:
- Press the Run button to animate the algorithm.
- Press the Pause button to pause the algorithm.
- Press the Reset button to clear.