Law of Large Numbers Simulator
The law of large numbers says the proportion converges. Almost everybody hears it as the counts evening out, and that is the gambler's fallacy — the belief that a run of tails makes heads "due". What actually happens is the opposite: the percentage settles down while the raw difference between heads and tails typically grows. This runs the experiment and shows both columns side by side, which is the only way that stops being counter-intuitive.
What this generator does
Shows convergence and divergence at the same time. The coin run calculator here gives the exact chance of a streak; the random walk simulator shows a path drifting. This one is specifically about the misunderstanding: it tracks the running proportion and the running surplus together, because seeing one settle while the other grows is what makes the point.
How to use this tool
- Set how many trials and the chance of a hit.
- Run it.
- Watch the proportion column settle while the gap column drifts.
- Add a seed if you want the same run twice.
Understanding the controls
- How many trials
- Ten to two hundred thousand. The interesting behaviour is all in the first few hundred, which is why the checkpoints are spaced logarithmically.
- Chance of a hit
- 50 for a coin, about 17 for one face of a die, 1 for something rare. Any value strictly between 0 and 100.
- Seed
- Reproduces the same run, which is useful when showing the same thing to two classes.
Worked examples
- 20,000 flips at 50%
- Proportion lands within a fraction of a percent of 50.
- The gap after 20,000 flips
- Often 50 or 100 either way — far larger than after 100 flips.
- The first checkpoint
- Ten trials, where the proportion can be anything at all.
- The same seed twice
- Identical run, down to the last trial.
Common use cases
- Showing a class what the law of large numbers actually claims
- Demonstrating why a run of losses does not make a win more likely
- Sanity-checking intuitions about how long a streak can go on
- Illustrating why small samples are unreliable
- Settling an argument about whether something is 'due'
How this generator works
Each trial is an independent draw against the probability you set. At logarithmically spaced checkpoints the tool records the running hit count, the proportion, and the surplus — the hits minus what was expected by then. The proportion converges towards the true probability; the surplus does not, and typically wanders further from zero as the run goes on. Every checkpoint is checked against its own counts before display, so the summary cannot drift from the data.
Randomness and fairness
Each trial uses the browser's cryptographically secure generator unless you supply a seed, in which case it uses a documented non-cryptographic one so the run can be reproduced. The point of the tool is what the randomness does over many trials rather than any single draw.
For how randomness is produced across the whole site, see how Generate Random works.
Assumptions this tool makes
- Every trial is independent and the probability never changes.
Limitations and good to know
- It simulates independent trials. Anything with memory — cards dealt without replacement, a machine that wears — behaves differently.
- It is a demonstration, not a proof. A single run can look unusual; that is what randomness looks like.
- Nothing here is a betting system. Knowing that runs happen does not make them predictable.
Common mistakes
- Expecting the counts to even out
- They do not, and that is the lesson. Only the proportion converges — the raw gap usually grows.
- Concluding a run is due after a streak
- Each trial is independent. The table looks the same after a streak as before one.
- Running 100 trials and drawing conclusions
- At 100 trials the proportion is still wandering. Run 10,000 and compare.
Practical tips
- Run it twice with the same settings and compare — the difference between two honest runs is itself the lesson.
- Try a 5% probability to see how long rare events can stay absent, and then how they cluster.
Privacy and your data
Everything runs in your browser from the numbers you set. Nothing is uploaded, nothing is stored, and none of your settings are written into the page address. Analytics records that the tool ran and how many trials it did.
Frequently asked questions
- Does the law of large numbers mean things even out?
- No. It says the *proportion* approaches the true probability. The absolute difference between hits and misses typically grows, and this tool shows both so the difference is visible rather than argued about.
- Is my run broken if the gap is large?
- Almost certainly not. A gap of a hundred in twenty thousand flips is half a percent, which is exactly what convergence looks like.
- Can I use this to predict anything?
- No. It demonstrates a property of many independent trials. It says nothing about the next one, and no arrangement of past results ever will.
Related generators
- Expected Value CalculatorThe long-run average of a set of weighted outcomes, with the variance beside it — and a note when the average is a result you can never get.
- Coupon Collector SimulatorHow many random draws it takes to collect a full set, against the exact harmonic-number expectation.
- Predator and Prey SimulatorRuns the Lotka-Volterra cycles and reports how far the model's conserved quantity drifted, which measures the numerical error rather than hiding it.
- Coin Run Probability CalculatorHow likely a streak of heads really is — counted exactly across every possible sequence, then simulated so you can watch the two agree.
- Sampling Distribution SimulatorTake a sample, take its mean, repeat — and watch means from even a badly skewed population pile up symmetrically.
- Random Walk SimulatorTakes a walk one coin flip at a time, draws the path, and says exactly how unusual the finish was.