Formula Forge Logo
Formula Forge

Simulating Multiple Coin Flips: Distributions, Streaks, and Visual Intuition

Simulations make randomness tangible. By generating thousands of flips, you can see how often certain outcomes happen, why streaks aren’t suspicious, and how distributions settle around their expected values.

No coin handy? Use /other/flip-a-coin-simulator to run batches and visualize results.

What to Measure

  • Heads count: Total heads in n flips follows a binomial distribution (n, p = 0.5).
  • Longest streak: The maximum run of consecutive heads (or tails) in n flips—surprisingly long streaks are common.
  • Run balance: Difference between heads and tails over time; should wander around zero.

Expected Patterns

  • Heads totals: Centered near n/2 with spread ≈ √(n × 0.5 × 0.5).
  • Streaks: In 100 flips, runs of 5–7 heads/tails happen routinely; don’t assume bias.
  • Law of large numbers: Over many flips, the proportion of heads approaches 0.5, but short segments can be lopsided.

Visualizations to Try

  • Histogram of heads counts across many trials (e.g., 1,000 runs of 50 flips).
  • Streak length distribution for the max run per trial.
  • Cumulative heads proportion over time within a single long run.

Small JavaScript‑Style Pseudocode

function simulate({ trials = 1000, flips = 100 }) {
  const headsCounts = [];
  const maxStreaks = [];
  for (let t = 0; t < trials; t++) {
    let heads = 0, streak = 0, maxStreak = 0;
    for (let i = 0; i < flips; i++) {
      const isHead = Math.random() < 0.5;
      heads += isHead ? 1 : 0;
      streak = isHead ? streak + 1 : 0;
      if (streak > maxStreak) maxStreak = streak;
    }
    headsCounts.push(heads);
    maxStreaks.push(maxStreak);
  }
  return { headsCounts, maxStreaks };
}

FAQs

Why simulate if the math is known? Seeing distributions and streaks builds intuition, catches implementation mistakes, and validates assumptions.

How many trials do I need? Hundreds to thousands are fine for coarse intuition. For precise estimates, scale up and add confidence intervals.

Try our Free Flip a Coin Simulator →
Related Articles