Coin Flipper
{{ currentFlipText }}
{{ headCount }} Heads {{ tailCount }} Tails {{ headPercent }} % H / {{ tailPercent }} % T {{ streak.currentFace }} streak: {{ streak.current }}
{{ beep_volume }}%
Hz:
ms:

Metric Value Copy
{{ row.label }} {{ row.display }}
  • Flip {{ totalFlips - i }} {{ r ? 'Heads' : 'Tails' }}

                
:

A coin toss is one of the simplest chance events: two outcomes, a quick result, and just enough uncertainty to settle a tie or illustrate probability in a familiar way. This package turns that idea into a tracked run, showing the latest face while also recording the full sequence of flips.

That matters when the result needs to be visible rather than fleeting. A one-off tiebreaker only needs the current face, but a classroom demo, game night dispute, or probability exercise benefits from running counts, percentages, a streak readout, and a distribution chart that updates as the session grows.

The default behavior stays close to an ordinary fair-coin example, but the advanced panel broadens the use case. You can bias the chance toward heads or tails, switch from system randomness to a seeded deterministic sequence, run a large batch without animation, and add optional reveal cues for heads.

Those extra controls make the tool more useful for repeatable demonstrations, yet they also create the main interpretation risk. A lopsided short run does not prove the coin model is skewed, and a repeated seeded run only restarts from the beginning when the generator itself is reset, not merely when the visible history is cleared.

It also helps to keep the scope straight. This is a browser-based simulator for simple decisions and probability demonstrations, not a fairness tester for physical coins and not a cryptographic randomness service.

Everyday Use & Decision Guide:

For a plain tiebreaker, leave Bias toward Heads (%) at 0, keep RNG mode on System RNG, and use the newest face only. The counts and chart are still recorded, but they should not outweigh the immediate Heads or Tails result when the goal is simply to decide.

  • Use Seeded RNG with a memorable Seed when you want a repeatable classroom or testing run rather than a fresh draw each time.
  • Use Flip xN for batch experiments. It resolves up to the package cap quickly and updates Flip Metrics, Flip Distribution, History, and JSON together.
  • If a short run looks suspicious, check Bias toward Heads (%) and Total flips before drawing conclusions. Ten or twenty flips can look uneven even under a neutral setup.
  • Before sharing a result, make sure the counts in Flip Metrics match the split shown in Flip Distribution. If you changed settings mid-run, use Reset and start again from known inputs.

The most common overread is treating a streak as evidence of a trend. A streak is just the length of the current run of identical faces, so treat it as a description of what happened recently, not as a promise about what comes next.

Technical Details:

At its core, the package models a coin toss as a two-outcome trial with a configurable probability of heads. In the neutral setting, heads and tails each start with a 0.5 chance in the long run, which is the familiar textbook fair-coin assumption. Moving the bias control changes that probability before every draw, so the tool can act like a weighted coin without changing any of the downstream counting logic.

Each resolved flip is stored as a boolean in flip_history. From that history, the package derives Total flips, the heads and tails counts, the one-decimal percentages, and Current streak, which is computed by walking backward from the most recent face until the run breaks.

Randomness comes from one of two sources. System RNG uses the browser's ordinary random number source. Seeded RNG hashes the seed string into a 32-bit state and then advances a deterministic pseudo-random sequence, which is why the same seed can reproduce the same run when the generator is restarted.

The package also distinguishes between visual behavior and statistical behavior. Animation duration, spin turns, tilt, and reduced-motion handling affect how the flip is revealed, but they do not alter the stored result. Optional vibration and beep cues only fire when Celebrate Heads is enabled and the resolved face is heads.

Formula Core

The bias slider is converted into a heads probability, then clamped into the valid probability range from 0 to 1. A generated draw less than that configured probability becomes heads; everything else becomes tails.

pH = clamp ( 12 + b200 , 0 , 1 ) Heads if u < pH ; otherwise Tails
Symbol mapping for the coin flip model
Symbol Meaning Maps to
b Bias offset in percentage points toward heads Bias toward Heads (%)
pH Configured probability of heads after clamping pHeadsConfigured in JSON
u Generated draw in the half-open interval [0, 1) System or seeded random generator

A bias of 0 leaves the model at 0.5. A bias of +30 moves the heads chance to 0.65, while +100 and -100 clamp the model to all-heads or all-tails behavior.

Result Model

The percentages are simple run summaries rather than predictions. If a session has H heads across N recorded flips, the package reports Heads % = 100 x H / N and rounds the display to one decimal place. The donut chart uses the same counts, so chart and metrics should agree unless the run was reset or changed mid-session.

Startup and reset behavior matter when you compare runs. The page performs a flip on load so the result area is immediately populated. Reset clears the existing history, sets the current face back to neutral, and then performs one fresh flip right away, which means a reset session begins with a new first recorded result rather than an empty state.

Batch mode is deterministic about count handling. Auto-flip xN is floored to an integer, clamped into the range from 1 to 5000, and resolved without animation. That makes it practical for quick sampling, but the run is still just one realization of the configured probability model.

Comparability Notes

If you want to compare two sessions fairly, keep the bias, RNG mode, seed, and starting history conditions aligned. Changing any one of those changes the meaning of the comparison. In particular, seeded replay depends on the generator state, so clearing the visible history without also resetting the seed path does not reproduce the original first flips.

Main result surfaces for the coin flipper
Surface What it shows Best use
Flip Metrics Counts, percentages, current streak, RNG mode, and bias Checking a run summary at a glance
Flip Distribution Heads-versus-tails share as a donut chart Spotting whether the split matches the counts
History Reverse chronological list of recorded flips Auditing the order of outcomes
JSON Inputs, derived statistics, and the full history array Documenting or replaying a setup

Step-by-Step Guide:

Use the quick branch when you only need a decision. Use the controlled branch when you want repeatability, bias, or a larger sample.

Quick decision run

  1. If the page already contains an older run, press Reset. The history will clear and the summary area will immediately record a fresh first result.
  2. Leave Bias toward Heads (%) at 0 and keep RNG mode on System RNG.
  3. Press Flip Coin. The summary face changes, and Flip Metrics updates its counts and percentages.
  4. Use the newest face as the decision result. Older rows in History are context, not a second vote.
  5. If you need a record, open History or JSON after the deciding flip.

Controlled or repeatable run

  1. Open Advanced, switch RNG mode to Seeded RNG, and enter a Seed you can reuse later.
  2. Set Bias toward Heads (%) if you want a weighted model, then decide whether you want a single flip or a batch in Auto-flip xN.
  3. Use Disable animation for faster testing, or keep animation on when the reveal itself matters.
  4. Run the session with Flip Coin or Flip xN. Check Flip Metrics first, then confirm the same split in Flip Distribution.
  5. If Flip xN does nothing, make sure the requested count is at least 1. The button stays disabled when the field is empty or zero.
  6. To replay the same starting sequence, change the Seed or toggle RNG mode before rerunning. Reset alone clears the log but does not rewind the seeded generator.

Interpreting Results:

For a decision, the most important output is the latest face in the summary area. For an experiment, read Total flips, Heads %, Tails %, and Current streak together, because none of them means much in isolation.

  • If Total flips is small, treat a streak as noise rather than evidence of bias.
  • If one face never appears, check whether the bias has been clamped to +100 or -100.
  • If a run should be repeatable, compare RNG mode, Seed, and the inputs shown in JSON before comparing the outcome sequence.

The main false-confidence trap is reading a dramatic short run as proof that something deeper is happening. The corrective check is simple: confirm the settings first, then look at whether the chart, metrics, and history all describe the same session.

Worked Examples:

Repeatable single flip for a documented tiebreaker

Set RNG mode to Seeded RNG, enter class-demo as the Seed, keep Bias toward Heads (%) at 0, and press Reset. The new first recorded result is Heads, Total flips becomes 1, and History contains one heads entry. That gives you a visible, repeatable tiebreaker state you can explain afterward.

Boundary case with fully clamped bias

Set Bias toward Heads (%) to +100, enter 8 in Auto-flip xN, and run the batch. The package records Heads = 8, Tails = 0, and Heads % = 100.0, while the donut chart collapses to a single heads slice. That outcome is useful for teaching what the bias clamp does, but it no longer represents an ordinary coin model.

Why a seeded rerun did not replay from the start

Use Seeded RNG with the seed lab-1 and flip five times. History ends with Heads, Heads, Heads, Tails, Heads. If you then press Reset and run five more flips without changing the seed path, the next five results are Heads, Heads, Heads, Tails, Tails rather than a replay of the original first five. The correction is to change Seed or toggle RNG mode before the rerun so the deterministic generator starts from its initial state again.

FAQ:

Why is there already a result when the page opens?

The package performs one flip on load so the summary area, counts, and tabs are populated immediately. If you want to start a new session from your own settings, change them first and then use Reset.

Does Reset leave the tool empty?

No. Reset clears the old history and immediately performs a new flip. That is useful for starting a fresh run quickly, but it means the tool returns to a one-result state rather than a blank log.

Why do I keep seeing streaks in a fair setup?

Because fair does not mean alternating. With Bias toward Heads (%) = 0, streaks are still normal in short runs. Check Total flips before deciding that the session is skewed.

How do the vibration and beep settings actually work?

They are heads-only cues. The package only triggers vibration or sound when Celebrate Heads is enabled and the resolved face is heads, and device support still depends on the browser and hardware.

Can I use this for security-sensitive randomness?

That is not the right fit. The package offers ordinary browser randomness and a deterministic seeded generator for repeatable demonstrations, not a security-oriented random service.

Glossary:

Bias
Configured shift away from a 50/50 heads-versus-tails model.
Seeded sequence
Repeatable pseudo-random run created from a seed string.
Streak
Current uninterrupted run of the most recent face.
Two-outcome trial
A random event here represented by heads or tails.