An interactive visualization of the Monte Carlo method for estimating the value of π.
Random points are scattered uniformly across a unit square. A quarter circle of radius 1 is inscribed in the square. The ratio of points landing inside the quarter circle to the total number of points approximates π/4, giving us:
π = 4 * (points inside circle) / (total points)
As the number of samples increases, the approximation converges toward the true value of π (3.14159...).
- Realtime — Points appear one batch at a time with animation. Choose between normal and fast speed.
- Non-realtime — All points are computed at once in a background thread and rendered when complete.
This project is licensed under the Apache License 2.0. See LICENSE for details.