This Web page performs two different Monte Carlo simulations that can be used to approximate the value of π.
Random darts: Consider throwing darts at a square dart board that has a circle inscribed in it. If the darts are completly random (i.e., equally likely to land anywhere in the square), then the ratio (darts inside the inscribed circle)/(total darts in the square) is an approximation of (area of circle)/(area of square) = π*radius^{2}/(2*radius)^{2} = π/4. Therefore, π ≈ 4*(darts in circle)/(total darts in square).
Random needles: Consider dropping needles on a table top that has vertical lines drawn on it, where the distance between the lines is twice the length of the needles. French mathematician GeorgesLouis Leclerc, Comte de Buffon proved that a randomly dropped needle (i.e., one that is equally likely to land anywhere, at any angle) has a 1/π chance of landing on a line. Thus, π ≈ (total needles on table) / (needles crossing a line).
Number of darts to generate:
 
 
Number of needles to generate:
