This is a visual explanation of how Monte Carlo methods can be used to estimate the value of Pi. It is a circle inscribed within a square. Click the button to simulate the dropping of 1000 needles randomly across the square. An estimate of Pi is calculated based on the proportion of points that fall within the circle. Repeating this simulation many times and averaging the results will yield a fairly accurate approximation of the true value of Pi.
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js