Buffon's Needle

This applet provides a simulation of a needle of length 1 being dropped on a floor covered with boards of width 1. Sometimes the needle will land completely on one board, while other times it will cross over the joint between two boards. The needle is assumed to be dropped "at random". This is interpreted to mean that the location of the center of the needle (taken with respect to the "lower" board) is a uniform [0,1] random variable, and that the angle the needle makes with the horizontal is uniformly distributed on [0,Pi]. If X represents the ratio of crossings to attempts, then 2/X should approach a familiar number.

Reference:

Buffon's needle is discussed in many probability texts. One is
Richard W. Hamming, The Art of Probability for Scientists and Engineers Addison-Wesley, 1991

Source Code

This applet uses the Danby package in additon to the following java files: