HomeMathematicsQuasi-Monte Carlo 2D: Point-Set Discrepancy Race

Quasi-Monte Carlo 2D: Point-Set Discrepancy Race

Watch pseudorandom Monte Carlo and a 2D Halton low-discrepancy sequence race side by side to estimate π by sampling a circle inscribed in a square, with a live star-discrepancy metric showing exactly how much more evenly the Halton points cover the plane.

Mathematics2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-monte-carlo-methods-mathematics ↗ Open standalone

This simulator races two sampling strategies side by side at a classic Monte Carlo task — estimating π by sampling a unit circle inscribed in a square — while computing the actual star discrepancy of each growing point set, not just the resulting π error. One panel draws points with ordinary pseudorandom numbers; the other uses a 2D Halton low-discrepancy sequence built from the van der Corput construction in bases 2 and 3, which fills the square far more evenly than chance would from the very first samples. Live readouts track both running π estimates, their errors against the true value, and an exact anchor-point star-discrepancy statistic D*ₙ for each sequence, so the structural difference between random and quasi-random sampling — not merely its downstream effect on one integral — is visible and independently verifiable in real time.

⚙ Under the hood

Race a pseudorandom Monte Carlo sampler against a 2D Halton low-discrepancy sequence side by side as both estimate π by sampling a circle inscribed in a square, with a live exact star-discrepancy statistic and a cell-deviation grid overlay showing which point set actually covers the plane more evenly.

monte-carloquasi-monte-carlonumerical-integrationhalton-sequencediscrepancyprobability2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)