Coin Flipper
Flip a fair or biased coin with fresh or seeded randomness, then compare observed counts with expected outcomes and reproducible streak history.{{ summaryTitle }} {{ summaryValue }} {{ summaryLine }} {{ badge.label }} {{ badge.value }}
| Flip | Result | Running Heads | Current streak | Copy |
|---|---|---|---|---|
| {{ row.flip }} | {{ row.result }} | {{ row.runningHeads }} | {{ row.streak }} |
A run of heads does not make tails “due.” In an independent coin model, every draw uses the same configured probability regardless of the faces that came before it. Streaks describe the recorded sequence; they do not predict the next result.
A fair coin assigns probability 0.5 to heads and 0.5 to tails. A biased model intentionally moves that split. Bias belongs to the setup, while the observed percentage belongs to the sample. A short sample can differ sharply from its configured probability without showing that the random process is broken.
| Model | What stays fixed | Useful for |
|---|---|---|
| Fair | Heads chance remains 50% on every draw. | Low-stakes choices and basic probability demonstrations. |
| Biased | The chosen heads chance remains constant on every draw. | Weighted demonstrations and Bernoulli experiments. |
| Seeded | The same seed recreates the same number sequence from the start. | Lessons, examples, and reproducible checks. |
Expected counts are averages from the probability model, not required outcomes. With a 70% heads chance, 100 flips have an expected heads count of 70, yet another total is entirely possible. As the sample grows, the observed share often settles nearer to the configured probability, but it never has to land exactly on it.
A random source and a repeatable source solve different problems. Fresh system randomness fits an ordinary draw. A seeded sequence is predictable once its seed and method are known, which is useful for replay but unsuitable when unpredictability protects money, access, prizes, or security.
Digital coin outcomes are appropriate for games, classroom exercises, demonstrations, and casual decisions with no monetary value. Audited lotteries, gambling, cryptographic secrets, and regulated selections need a process designed and reviewed for that purpose.
How to Use This Tool:
Choose fresh or repeatable randomness, set the probability, and then read the latest face separately from the session statistics.
- Choose System randomness for fresh browser-generated draws or Seeded sequence for replay. Seeded mode requires 1 to 80 characters of seed text.
- Set Heads bias from −100% to 100%. Zero gives a 50% heads chance, positive values favor heads, and negative values favor tails. Changing the mode, seed, or bias clears the existing session.
- Set Flips per action from 1 to 100 and press the coin. The page begins with one flip and appends each later action until the 5,000-flip session limit is reached.
- Compare observed and expected counts in Outcome distribution, then use Flip ledger when order, running heads percentage, or streak position matters.
Interpreting Results:
The latest face answers the immediate draw. Heads count, tails count, observed percentages, and streaks summarize the whole session. Do not use a session statistic to rewrite the result of an individual flip.
Heads gap is the observed heads percentage minus the configured heads percentage, measured in percentage points. A −30 percentage-point gap means the sample's heads share is 30 points below the chosen model, not that heads has become more likely on the next draw.
Use a seeded replay to verify that a documented sequence can be reproduced. Use system randomness for a new draw. Neither mode proves fairness by itself; fairness is the configured 50% model, while a finite session remains subject to random variation.
Technical Details:
Each flip is a Bernoulli trial with two outcomes. A uniform draw u lies in the half-open interval from 0 inclusive to 1 exclusive. The result is heads when u is smaller than the configured heads probability; equality belongs to tails.
Formula Core:
The bias control shifts the heads probability linearly from 0 to 1.
b is Heads bias in percentage units. Thus −100 gives pH = 0, 0 gives 0.5, and 100 gives 1.
For n flips, expected heads and tails counts come directly from the configured probability.
The observed heads percentage and the displayed gap are:
Randomness Mechanism Core:
| Mode | Draw source | Reproducibility and limit |
|---|---|---|
| System randomness | A 32-bit browser cryptographic random value divided by 232, with Math.random() as a fallback when the stronger browser source is unavailable. | Fresh values are not intentionally replayable. |
| Seeded sequence | The seed is reduced to a 32-bit FNV-1a state and expanded by a deterministic Mulberry32 sequence. | The same seed, bias, and flip count reproduce the same faces in this model. |
Current and longest streaks scan consecutive equal faces. If two runs share the same maximum length, the first run to reach that length remains the reported longest streak. All counts, running percentages, and expected values derive from the same recorded draws.
No rounding changes the outcome rule. Percentages are calculated from full numeric values and formatted for display. At exactly u = pH, the strict less-than comparison produces tails.
Accuracy and Responsible Use:
The session is a probability demonstration and casual randomizer. It does not certify a physical coin, audit a random-number generator, or supply a legally controlled draw.
- System mode prefers browser cryptographic randomness but can fall back to a non-cryptographic source.
- Seeded mode is intentionally predictable and must not generate passwords, keys, tokens, gambling results, or prize selections.
- Inputs and session history remain in the browser during the workflow; copied and downloaded records inherit the privacy of the device and destination.
- Outcomes have no monetary value and should not be used where money, safety, access, or compliance depends on the draw.
Worked Examples:
Replaying a five-flip lesson
Choose Seeded sequence, use demo-seed, keep bias at 0%, and record five flips. The sequence is tails, heads, tails, tails, tails. That produces one head, four tails, a 20% observed heads share, and a −30 percentage-point gap from the 50% model. Repeating the same setup reproduces the sequence; it does not make that short run representative of every fair session.
References:
- Binomial Distribution, OpenStax, Introductory Statistics 2e.
- Crypto.getRandomValues(), MDN Web Docs, August 19, 2025.