Skip to main content
MakeMyPasswords

Probability Basics — Coin Flips, Dice, and Fairness

·6 min read

Flip a coin ten times and get heads every single time. What's the probability the next flip is heads? If your gut says "tails is due," you're in good company — and you're wrong. The coin doesn't know what it did before. Understanding why is the foundation of everything else in probability.

Uniform Randomness

A fair coin has two equally likely outcomes. A fair d6 has six. A fair d20 has twenty. When every outcome has the same probability, the distribution is uniform. For a single fair coin flip, P(heads) = P(tails) = 0.5. For a d6, P(any face) = 1/6 ≈ 0.1667.

"Fair" is doing a lot of work in that sentence. A physical coin isn't perfectly fair — slight asymmetries in weight distribution, minting irregularities, and the physics of the flip all introduce tiny biases. Persi Diaconis, a Stanford mathematician and former magician, demonstrated in 2007 that a coin flipped by a human tends to land on the same face it started on about 51% of the time. For practical purposes this doesn't matter, but for precise experiments, a computer-generated random number beats a physical coin.

The Law of Large Numbers

Here's the most misunderstood theorem in probability: the law of large numbers says that as you increase the number of trials, the proportion of outcomes approaches the theoretical probability.

Flip a coin 10 times and you might get 7 heads (70%). Flip it 100 times and you'll probably see between 40 and 60 heads (40%–60%). Flip it 10,000 times and you'll land very close to 50%. The proportion converges.

But — and this is the critical part — the absolute deviation from the expected count typically grows. After 10 flips, being off by 2 (7 heads instead of 5) is normal. After 10,000 flips, being off by 50 (5,050 heads instead of 5,000) is equally normal. You're closer in percentage terms (50.5% vs 50%), but farther in absolute count.

This means the law of large numbers is about ratios, not about individual results "correcting" themselves. The coin doesn't keep a ledger. It doesn't owe you tails.

The Gambler's Fallacy

The gambler's fallacy is the belief that past random outcomes influence future ones. "Red has come up six times in a row on the roulette wheel, so black is due." Casinos love this belief. It's what keeps people at the table.

Each spin of a fair roulette wheel is independent. The ball doesn't remember where it landed last time. The probability of black on the next spin is 18/38 (on an American wheel) regardless of what happened before. Six reds in a row doesn't make seven reds less likely — the probability is the same as it was before the streak started.

The fallacy feels rational because we're wired to see patterns. A sequence like HHHHHH (six heads in a row) feels "less random" than HTTHHT, even though both specific sequences are equally probable. Any predetermined sequence of six coin flips has a probability of (1/2)^6 = 1/64. We just don't notice when "random-looking" sequences occur because they don't trigger our pattern detectors.

Where it gets subtle: the gambler's fallacy is wrong for independent events (coin flips, dice rolls, roulette spins), but there are situations where past outcomes do affect future probabilities. Drawing cards from a deck without replacement is the classic example — if three aces are already on the table, the chance of drawing the fourth ace from the remaining deck is higher than normal. The key question is always: does the system have memory?

Expected Value: What "Average" Means

The expected value (EV) of a random event is the long-run average outcome. For a fair d6:

EV = (1 + 2 + 3 + 4 + 5 + 6) / 6 = 3.5

You'll never actually roll a 3.5, but over thousands of rolls, your average will converge to it. For a coin flip where heads = 1 and tails = 0, EV = 0.5.

Expected value becomes genuinely useful when you attach stakes. Suppose someone offers you this bet: roll a d6, and they pay you $10 times the result, but it costs $40 to play. Should you take it?

EV = $10 × 3.5 - $40 = $35 - $40 = -$5

On average, you lose $5 per game. If the entry fee were $30, the EV would be +$5 and the bet is in your favor. Every casino game has a negative expected value for the player (that's how casinos work). The house edge on American roulette is about 5.26%. On blackjack with basic strategy, it's around 0.5%. On slot machines, it varies from 2% to 15%.

Testing Fairness: The Chi-Square Test

How do you know if a die is actually fair? Rolling it a few times isn't enough — randomness is clumpy, and short sequences can easily look biased even when they're not. You need a formal statistical test.

The chi-square goodness-of-fit test compares observed results to what you'd expect from a fair die. Here's how it works:

  1. Roll the die many times. At least 60 rolls for a d6 (so the expected count per face is at least 10). More is better — 300 rolls gives much more reliable results.

  2. Count each outcome. For a d6 rolled 300 times, you'd expect 50 of each face.

  3. Calculate the chi-square statistic:

χ² = Σ (observed - expected)² / expected

For each face, compute (O - E)² / E, then sum them all.

  1. Compare to the critical value. For a d6, there are 5 degrees of freedom (6 faces minus 1). At the standard 95% confidence level, the critical value is 11.07.

If your χ² is below 11.07, the die is consistent with being fair. If it's above, the data suggests bias.

Example: You roll a d6 300 times and get: 1→58, 2→45, 3→53, 4→47, 5→52, 6→45.

χ² = (58-50)²/50 + (45-50)²/50 + (53-50)²/50 + (47-50)²/50 + (52-50)²/50 + (45-50)²/50
   = 64/50 + 25/50 + 9/50 + 9/50 + 4/50 + 25/50
   = 1.28 + 0.50 + 0.18 + 0.18 + 0.08 + 0.50
   = 2.72

2.72 is well below 11.07, so this die passes the fairness test. The slight unevenness (58 ones vs 45 twos) is within normal random variation.

A truly loaded die would show something like 1→80, 6→20 over 300 rolls, giving a χ² far above the critical value. But be warned: the chi-square test can only detect bias if you roll enough times. A die that lands on 6 about 20% of the time instead of 16.7% (mildly biased) needs hundreds of rolls to detect reliably.

Independence and Why It Matters

Two events are independent if knowing one outcome tells you nothing about the other. Coin flips are independent. Dice rolls are independent. Drawing cards from a shuffled deck without replacement is not independent — each draw changes the composition of the deck.

In games, independence determines whether streaks are meaningful. In craps, each roll is independent, and a "hot streak" is just normal variance. In poker, each card dealt changes the probability space for the next card, so card counting can actually work (in theory — casinos have countermeasures).

For digital random number generators, independence is essentially guaranteed — each call to Math.random() or crypto.getRandomValues() produces a result with no dependence on previous calls. This makes computers better sources of "fair" randomness than physical objects for most purposes, which is why our coin flip tool uses a software random number generator rather than simulating physical coin dynamics.

Randomness Is Clumpy

The biggest practical lesson from probability: random sequences don't look as "even" as people expect. True randomness produces streaks, clusters, and dry spells. If you flip a coin 200 times, you should expect at least one run of 7 or more identical results. That's not the coin being broken. That's what randomness actually looks like.

The next time you flip heads five times in a row, resist the urge to bet on tails. The coin doesn't care about its history, and neither should your strategy.

Related Tool

🪙 Coin Flip

Flip a virtual coin — heads or tails with animated results.

Try Coin Flip