Want the area of a weird shape? Throw random darts at a box around it and count the fraction that land inside — that fraction times the box area IS the answer. Here we estimate π: darts in a square, count those inside the quarter-circle. The error shrinks like 1/√N — slow, but it doesn’t care how many dimensions you have, which is why physics and finance live on it. Slide to throw more darts.
Monte Carlo integration estimates a quantity by random sampling: to get π, scatter N points uniformly in the unit square and count the fraction inside the quarter unit-circle — that fraction ≈ π/4. By the law of large numbers the estimate converges to the true value, with statistical error shrinking like 1/√N (independent of DIMENSION, which is why it beats grid methods for high-dimensional integrals in physics, finance, and Bayesian inference / MCMC). A good pseudo-random generator matters: correlated low-quality bits bias the estimate. A fail-loud self-check throws unless 200k darts (mulberry32) estimate π within 0.01. ◆ real numerical methods, node-verified.
Convergence is only 1/√N — 100× the darts for one more digit — and the result is a random estimate with a confidence interval, not an exact value; a poor RNG biases it. The 1/√N law and the π/4 geometry are exact.