Coin Flip โ Heads or Tails
Flip a virtual coin up to 100,000 times. Set bias (50% = fair). Track heads/tails %, longest streaks. Law of Large Numbers: more flips โ proportion converges to true probability.
โจ The Fun Behind This
Why It's Fun
Coin flips are Bernoulli trials. Law of Large Numbers: as nโโ, sample proportion โ true probability. Streaks are normalโeach flip is independent.
How It Works
Set number of flips (1โ100K), heads bias (50 = fair). Toggle animation. Click Flip. We show heads/tails %, longest streaks, last 20 flips.
Key Insights
- โFair coin = 50% heads. Each flip independent.
- โ10 heads in a row: 1 in 1,024. Streaks are normal.
- โ100 flips: ยฑ5% typical. 10K flips: ยฑ0.5%.
Heads or Tails?
Flip up to 100,000 times. Track statistics, streaks, and see the law of large numbers in action.
๐ช Quick Examples โ Click to Load
Settings
Configure the number of flips (1 to 100,000), set a custom heads probability for biased coins, and toggle animation for small samples.
For educational and informational purposes only. Verify with a qualified professional.
๐ฒ Fun Facts
A US penny flipped 10,000 times lands heads ~51% due to slight weight bias.
โ Stanford
The probability of 10 heads in a row with a fair coin is 1 in 1,024 (0.098%).
โ 2^10
Coin flips used in NFL kickoffs, cricket tosses. Ensures fairness.
โ Sports
๐ Key Takeaways
- โข A fair coin has 50% probability of heads on each flip (Bernoulli trial)
- โข The Law of Large Numbers states that as you flip more, the observed proportion converges to the true probability
- โข Streaks of 5+ same results are common even with a fair coin โ they don't indicate bias
- โข Each flip is independent โ past results don't affect future flips
๐ก Did You Know?
๐ How It Works: Law of Large Numbers
Each coin flip is a Bernoulli trial with two outcomes. For a fair coin, P(Heads) = P(Tails) = 0.5. With a biased coin, you set the heads probability (e.g., 60% means P(Heads) = 0.6).
Law of Large Numbers
As the number of flips (n) increases, the sample proportion of heads converges to the true probability. With 10 flips you might see 70% heads by chance; with 10,000 flips you'll typically see 49โ51% for a fair coin.
Streak Analysis
Longest streak of consecutive heads (or tails) follows a known distribution. For n flips, the expected longest run of heads is approximately logโ(n). So 1000 flips often yields a streak of ~10.
Independence Assumption
Each flip is independent โ the outcome of one flip does not influence the next. This is why the "hot hand" or "due for a tails" beliefs are fallacies. The coin has no memory.
๐ฏ Expert Tips
๐ก Use for Fair Decisions
Single flip with 50% bias is perfect for breaking ties โ who goes first, which option to choose.
๐ก Teach Probability
Run 100, then 10,000 flips to demonstrate convergence. Compare percentages.
๐ก Disable Animation for Speed
For 1000+ flips, turn off animation to get instant results.
๐ก Biased Coin Simulation
Set 60% or 70% heads to simulate weighted coins or loaded dice concepts.
โ๏ธ Comparison Table
| Flips | Typical Heads % | Expected Max Streak | Std Dev of % |
|---|---|---|---|
| 10 | 30โ70% | 3โ4 | ยฑ15.8% |
| 100 | 40โ60% | 5โ7 | ยฑ5% |
| 1000 | 47โ53% | 8โ10 | ยฑ1.6% |
| 10000 | 49โ51% | 11โ13 | ยฑ0.5% |
Standard deviation of proportion = 1/(2โn). As n increases, results cluster tighter around 50%.
๐ Step-by-Step: How Streaks Are Calculated
1. Perform flips: For each of n flips, generate a random number. If it < headsBias/100, record H; else T.
2. Count heads and tails: Sum all H and T. Heads % = (headsCount / n) ร 100.
3. Find longest heads streak: Scan the sequence. Track current run of H. When we hit T, compare current run to max; reset current. Longest run = max.
4. Find longest tails streak: Same algorithm, but track runs of T.
5. Display last 20 flips: Show the most recent 20 flips for quick verification (e.g., H T H H T T H...).
โ Frequently Asked Questions
Is a coin flip truly 50/50?
A fair, evenly weighted coin has approximately 50% chance of heads. Real coins can have slight bias (e.g., US penny ~51% heads) due to weight distribution.
What is the law of large numbers?
As you repeat an experiment (like flipping) more times, the observed proportion gets closer to the true probability. 10 flips can vary wildly; 10,000 flips will be very close to 50%.
Why do I see long streaks of heads?
Streaks are normal! With 100 flips, a streak of 7 consecutive heads or tails is expected. Each flip is independent โ past results don't affect the next.
Can I use this for decisions?
Yes! A single fair flip is a classic way to make a 50/50 decision โ who goes first, which option to pick. It's unbiased and quick.
What does "biased coin" mean?
A biased coin has unequal probabilities. 60% heads means P(Heads)=0.6, P(Tails)=0.4. Useful for teaching or simulating unfair games.
How many flips to see convergence?
Roughly 100+ flips for noticeable convergence; 1,000+ for strong convergence. The standard deviation of the proportion decreases as 1/โn.
Is the random number generator fair?
JavaScript Math.random() uses a pseudorandom algorithm. It's statistically uniform for most purposes but not cryptographically secure.
What's the longest possible streak?
Theoretically, all flips could be the same (probability = p^n). With 100 fair flips, the expected longest run of heads is about 6โ7.
Can I use this for sports or games?
Yes! Many sports use coin flips for kickoffs, first serve, etc. This simulator is perfect for practicing or teaching fair decision-making.
Why do my results differ each time?
Each run uses new random numbers. Variability is expected โ that's the nature of probability. Run many times to see the distribution.
What's the difference between bias and fair?
Fair = 50% heads, 50% tails. Bias shifts the probability โ 60% means 6 in 10 flips expected heads on average.
๐ Probability Stats
๐ Sources
๐ฎ Use Cases
Fair Decision Making
Single flip with 50% bias. Perfect for: who goes first in a game, which restaurant to pick, breaking ties in voting.
Probability Education
Run 10, 100, 1000, 10000 flips to demonstrate convergence. Compare observed % to expected 50%.
Streak Analysis
Study longest runs of heads or tails. See that 5โ7 streak in 100 flips is normal, not "lucky" or "unlucky."
Biased Coin Simulation
Set 60% or 70% heads to simulate weighted coins. Useful for teaching conditional probability.
๐ Extended Probability Facts
Binomial Distribution: The number of heads in n flips follows a binomial distribution B(n, p). The expected value is np and variance is np(1-p). For a fair coin, expect n/2 heads with standard deviation โ(n/4).
Central Limit Theorem: As n grows, the distribution of the proportion of heads approaches a normal distribution. This is why 10,000 flips almost always gives 49โ51% for a fair coin.
First-Time Events: The expected number of flips to get the first heads is 2 (geometric distribution). The expected flips to see both H and T at least once is 3.
Runs and Patterns: In n flips, the expected number of "runs" (maximal sequences of same outcome) is (n+1)/2. So 100 flips typically have ~50 runs.
Monte Carlo Methods: Simulating many random trials (like coin flips) is the basis of Monte Carlo simulation, used in finance, physics, and machine learning to estimate complex probabilities.
๐ Real-World Applications of Coin Flips
Sports & Games: NFL kickoffs, cricket tosses, tennis first serve, and board game turn order all use coin flips. The fairness comes from true 50/50 odds when both parties trust the process.
Scientific Experiments: Randomized controlled trials use coin flips (or equivalent RNG) to assign subjects to treatment vs control groups, eliminating selection bias.
Cryptography: Coin flips model binary random bits. Protocols like coin-flipping over the phone use cryptographic commitments to ensure neither party can cheat.
Decision Theory: When two options are equally preferable, a fair coin provides an unbiased tiebreaker. Used in voting, scheduling, and resource allocation.
Quality Control: A/B testing and random sampling in manufacturing rely on the same Bernoulli-trial logic. Each "flip" is an independent observation.
โ ๏ธ Common Misconceptions
๐ Classroom Activities & Teaching Tips
Activity 1: Convergence Demo
Have students run 10 flips, then 100, then 1000. Compare the heads percentage. Discuss why 10 flips varies more than 1000.
Activity 2: Streak Prediction
Before flipping, ask: "How many heads in a row would surprise you?" Run 100 flips. Often 5โ7 occurs โ discuss independence.
Activity 3: Biased Coin
Set 70% heads. Run 100 flips. Compare to 50% runs. Introduce conditional probability and weighted outcomes.
Activity 4: Fair Decision
Use single flip for a real class decision (e.g., which problem set to do first). Emphasize unbiased tiebreaking.
โ ๏ธ Disclaimer: This simulator uses pseudorandom numbers for educational and entertainment purposes. Results are statistically random but not cryptographically secure. For high-stakes decisions, consider physical coin flips or certified RNGs.
Related Calculators
Bingo Number Generator
Generate and track bingo numbers for 75-ball (US) and 90-ball (UK) games. Auto-call speeds, bingo card display, call history, and remaining numbers.
QuirkyDice Roller Calculator
Roll dice with statistics. Supports d4, d6, d8, d10, d12, d20, d100. Track frequency, averages, and probability.
QuirkyLottery Number Generator
Generate random lottery numbers for Powerball, Mega Millions, Pick 3, Pick 4, and custom games. Includes odds calculations.
QuirkyPIN Generator Calculator
Generate random PIN numbers with customizable length, quantity, and security options. Strength rating, combinations possible, and crack time estimates.
QuirkyPoker Hand Probability Calculator
Calculate odds of poker hands in Texas Hold'em, 5-Card Draw, and Omaha. Hand strength, pot odds, and expected value.
QuirkyRandom Card Generator
Draw random cards from a 52-card deck. Poker hand evaluation, suit symbols, remaining cards, and probability of next draws.
Quirky