twoodo
/

Home/Tools/Random & decision

Coin Flip

Press space to flip again.

Space bar flips again.

Try a hundred flips and look at the runs

This is the most instructive thing on the page. Flip a hundred times and you will see a run of six or seven the same in a row, and it will look wrong.

It is not. In a hundred flips the longest run is typically around log₂(100) ≈ 7. A stretch of six heads is expected, not remarkable.

Asked to write down a hundred "random" flips by hand, almost nobody produces a run longer than four, because long runs feel wrong. That difference is reliable enough that a statistician can usually tell a fabricated sequence from a real one at a glance.

There is no such thing as "due"

After five heads, the chance of heads next is still exactly one half. The coin has no memory and no mechanism for balancing out.

This is the gambler's fallacy, and it has a famous illustration: at the Monte Carlo casino in 1913 a roulette wheel came up black twenty-six times in a row. Players lost enormous sums backing red, each spin convinced it was overdue. Every spin was independent, and the wheel owed them nothing.

The law of large numbers does not mean what people think

Flip a thousand times and the proportion will sit near 50 %. But if heads is ahead by twenty flips, later flips do not compensate — the gap tends to grow in absolute terms while shrinking as a share of the total.

Convergence comes from the growing denominator, not from any correction.

Real coins are not quite fair either

A flipped coin caught in the hand lands the same way up as it started about 51 % of the time, because it precesses rather than tumbling cleanly. Spinning a coin on a table is far more biased — for some coins heavily so, because the rim is not symmetrical.

If a decision genuinely matters, flip and let it land on the floor.

Common uses

  • Settling a decision with no coin to hand.
  • Choosing who goes first.
  • Teaching probability — the run lengths do the teaching.
  • Finding out what you wanted, which is what a coin flip is often really for.

Questions people ask

Is a coin flip really 50/50?

Here, yes. A real coin caught in the hand lands as it started about 51 % of the time, and spinning one on a table is more biased still.

After five heads, is tails more likely?

No. Every flip is independent and the coin has no memory. Believing otherwise is the gambler's fallacy.

Why do I see such long runs?

Because they are expected. In a hundred flips the longest run is typically around seven. Fabricated sequences rarely contain runs longer than four.

Does the law of large numbers correct an imbalance?

No. The absolute gap tends to grow; it only shrinks as a proportion of a growing total. Nothing compensates.

What happened at Monte Carlo in 1913?

A roulette wheel came up black twenty-six times running, and players lost heavily backing red because they believed it was overdue.

Where the randomness comes from

Every result on these pages uses crypto.getRandomValues, your browser's cryptographically secure random generator, seeded by the operating system from genuinely unpredictable physical sources.

That is deliberately not Math.random(), which most tools use. Math.random is a deterministic algorithm producing numbers that look random; given enough output, its future values can be predicted. For a dice game that does not matter. For a prize draw, a password or anything anyone might want to game, it does.

The numbers are also produced by rejection sampling rather than by taking a remainder. Taking a random 32-bit number modulo 6 slightly favours the lower faces, because 232 does not divide evenly by 6. The bias is small and it is real, and discarding the leftover tail removes it completely.

Nothing leaves the page

Results are generated in your browser and are not transmitted or stored. Reload the page and they are gone — which matters most on the password generator.