Law of Large Numbers illustration

Law of Large Numbers

The law of large numbers says the average of many independent trials converges to the expected value. This simulator rolls a die, flips a coin or draws from a custom distribution thousands of times and plots the running mean homing in on its theoretical value, with the shrinking band around it showing how the fluctuations fall off like 1/√n. It makes the difference between the law of large numbers and the gambler’s fallacy concrete: the average settles, but the running total of heads minus tails keeps wandering.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • The running mean converges to the expected value; the typical deviation from it shrinks like 1/√n.
  • This is the weak law: the average is very likely close to the mean for large n, not guaranteed exactly equal.
  • The gambler’s fallacy confuses this: past results never "balance out" — the count of heads minus tails can grow even as the average settles.
  • Runs 100% in your browser — simulations are computed locally on your device.