This applet is designed to approximate the value of pi. It accomplishes this purpose by firing random data points at a circle inscribed within a square. The probability of a data point landing within the circle is a ratio of the circle's area to the area of the square.

Where r equals the length of the radius of the circle, the area of the circle is then π*r*r. The diameter of the circle is the same as the length of each side of the square. Since the diameter of the circle, twice the radius, equals (2*r), the area of the square is equal to (2*r)*(2*r).

The probability of a point landing within the circle equals (π*r*r)/(2*r*2*r). By then performing algebra and removing (r*r) from the numerator and the denominator the simplified equation becomes P(landing in circle) = π/4.

Next, multiply both sides by 4.

Pi is now equivalent to four times the probability of a data point landing in the circle.

## Simulation

Measurement | Value |

Number of Drops | |

Number of Hits | |

Hits / Drops | |

π ≈ 4 * Hits / Drops | |

### Simulation Credits

- Original Java Applet by Nick Exner (1998)
- JavaScript+HTML5 Remake by Evan Ramos (2014)