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' }}

            

Introduction:

A coin toss models a simple chance event with two outcomes and a clear proportion over time. It helps demonstrate fairness and supports transparent choices in groups.

You can keep it neutral or add a bias and save a seed so sequences repeat. Many use it as a fair coin flip simulator for lessons and team picks.

Provide a bias if needed then flip and watch the running split between heads and tails. The display updates immediately and a compact chart summarizes the proportions.

A quick example helps set expectations. Ten flips with a 20 percent bias toward Heads might show six Heads and four Tails. The exact sequence can differ each time.

Short runs can swing widely so compare larger samples for steadier proportions. For reproducible comparisons reuse the same seed across sessions and devices.

Technical Details:

A coin flip is modeled as independent Bernoulli trials that observe Heads or Tails per flip. The key quantity is the probability of Heads which can be neutral or adjusted by a user‑set bias. Results accumulate into proportions to show how often each outcome appears.

The computation transforms a bias percentage into a Heads probability then draws a random value each flip to decide the face. Proportions are the observed Heads and Tails counts divided by total flips and expressed as percentages for interpretation.

Interpretation centers on how close the observed proportion of Heads is to the configured probability. Values near the configured probability indicate typical sampling noise while small samples can sit far from the target. Long streaks can appear naturally in independent trials.

Comparisons are most meaningful when the same seed and configuration are used. Seeded mode reproduces the identical sequence for a given seed while system mode varies on each run.

pH = clamp ( 0 , 1 , 0.5 + b 200 )
Symbols and units for the bias-to-probability transform
Symbol Meaning Unit/Datatype Source
pH Probability of Heads dimensionless Derived
b Bias toward Heads percent Input
clamp Limits a value to 0 to 1 function Constant rule

Worked Example

Set b to 20. Compute the Heads probability.

pH = clamp ( 0 , 1 , 0.5 + 20200 ) = 0.6

Run N = 10 flips and suppose you observe H = 6.

HeadPercent = HN × 100 = 610 × 100 = 60 %

Interpretation: 60% aligns with a 0.6 target yet small samples can vary. Larger samples stabilize the proportion.

HeadPercent = HeadCountTotal × 100 TailPercent = TailCountTotal × 100

Variables & parameters:

Configuration parameters and meaning
Parameter Meaning Unit/Datatype Typical Range Notes
Bias toward Heads Shifts probability toward Heads percent −100 to 100 0 is neutral
RNG mode System randomness or seeded enum system | seeded Seeded repeats sequences
Seed Reproducibility key string any text Same seed → same order
Auto‑flip ×N Runs multiple flips quickly integer 1 to 5000 Capped for performance
Animation time Flip duration ms 80 to 2000+ Defaults to 450 ms
Spin turns Full rotations per flip integer 1 to 10 Visual only
Tilt 3D tilt angle degrees 0 to 30 Default 8°
Celebrate Heads Optional reveal cues boolean on | off Gates haptics and audio
Vibrate on reveal Haptic signal boolean on | off Device‑dependent
Audio beep Tone on Heads Hz | ms | percent ≥100 Hz · ≥20 ms · 0–100% Volume 0% is silent

Units, precision & rounding:

  • Percentages display with one decimal place using a dot as the decimal separator.
  • Heads and Tails counts are integers and proportions are derived as shown above.

Validation & bounds extracted from code:

Input validation and limits
Field Type Min Max Step/Pattern Error Text Placeholder
Bias toward Heads number −100 100 step 1
RNG mode select system|seeded
Seed text any string e.g. demo‑seed
Animation time number 0 step 10 ms
Spin turns number 1 10 step 1
Tilt number 0 30 step 1
Auto‑flip ×N number 0 5000 step 1
Beep frequency number 100 step 1 Hz
Beep duration number 20 step 10 ms
Beep volume range 0 100 step 1%

Randomness, seeds & reproducibility:

  • System mode uses the platform’s random source per flip.
  • Seeded mode hashes the seed into a 32‑bit value and advances a deterministic generator.
  • Given the same seed and configuration, the full sequence repeats exactly.
  • These generators are not intended for gambling or cryptography.

Networking & storage behavior:

  • Processing occurs on your device; no data is transmitted to a server.
  • CSV and JSON files are created locally and saved by your device.

Performance & complexity:

  • Auto‑flips run in O(N) time; charts refresh incrementally.
  • Batch runs are capped at 5000 to keep the interface responsive.

Diagnostics & determinism:

  • Identical inputs yield identical outputs in seeded mode.
  • Percentages update after every flip and display to one decimal place.

Security considerations:

  • Untrusted text in the seed is treated as data and not executed.
  • Clipboard and download actions require user gestures and system permission.

Assumptions & limitations:

  • Heads‑up Short samples can deviate far from the target probability.
  • Bias at −100% or 100% produces deterministic Tails or Heads respectively.
  • Seed hashing compresses strings to 32‑bit space; different seeds can collide in theory.
  • Haptic feedback depends on device support and user settings.
  • Audio playback can be blocked until a user gesture occurs.
  • Reduced‑motion preferences may suppress animations.
  • Charts may resize on window changes; totals remain accurate.
  • Random sources are pseudo‑random and not suitable for security‑critical uses.

Edge cases & error sources:

  • Non‑numeric inputs fall back to defaults for timing and tilt.
  • Negative animation durations clamp to a safe minimum.
  • Volume at 0% silences audio even when celebration is enabled.
  • Vibration requests may be ignored by the platform.
  • Switching RNG mode or seed resets the generator state.
  • Very large auto‑flip counts can make the interface feel busy.
  • Percentages round to one decimal; tiny changes can appear or disappear at boundaries.
  • Window focus changes can delay visual updates without affecting counts.
  • Clipboard writes can be blocked by policy; try after a click.
  • Accessibility settings that reduce motion affect the reveal timing.

Scientific and standards notes:

  • Bernoulli trials and the law of large numbers underpin the interpretation of proportions.
  • The haptic behavior follows platform Vibration API conventions and may vary by device.
  • Tone synthesis relies on the platform’s audio engine with simple sine waves.

Privacy & compliance:

  • No data is transmitted or stored server‑side.
  • Outcomes are purely random and have no monetary value.

Step‑by‑Step Guide:

Configure the probability model and view proportions for Heads and Tails.

  1. Set Bias toward Heads to 0 for neutral or any percent for tilt.
  2. Choose RNG mode then enter a seed if you need reproducibility.
  3. Press Flip to add one result to the totals and proportions.
  4. Use Auto‑flip ×N for larger samples when you want steadier percentages.
  5. Optionally enable celebration cues and adjust beep and vibration as preferred.

Example: Bias 20 and seeded mode with seed “class‑A” over 100 flips should land near 60% Heads.

  • Larger samples reduce volatility in the displayed percentages.
  • Reuse the same seed to reproduce sequences across sessions.
Pro tip: encode context in your seed such as “week3‑groupB” to keep runs organized.

FAQ:

Is my data stored?

No. All flips and stats are computed on your device. Files you save remain on your device unless you share them.

Clipboard and downloads require your action.
How accurate is the randomness?

It uses pseudo‑random sources. Seeded mode is deterministic and great for teaching. System mode varies naturally. Neither mode is designed for gambling or security.

What units and formats are used?

Counts are integers. Percentages show one decimal place. Optional files use human‑readable text with standard number formatting.

Can I use it offline?

Yes after the page loads. All computation runs on your device without a network connection.

Do I need a license or payment?

Use follows the app’s availability settings. There is no payment flow in the interface.

How do I reproduce a sequence?

Select seeded mode and enter a seed string. With the same settings and seed you will get the same sequence and proportions every time.

What does a “borderline” result mean?

Values near the configured probability are expected. If your sample is small treat differences of a few percentage points as normal variation.

Why do streaks appear?

Independent trials can cluster. Long runs of the same face happen naturally and do not imply bias unless they persist across large samples.

Troubleshooting:

  • No sound: increase volume, enable celebration, and interact once to allow audio.
  • No vibration: device or browser may not support it or it is disabled in settings.
  • Copy fails: system policies may block clipboard writes; try after a click.
  • Download blocked: allow downloads for this site in your browser settings.
  • Chart not visible: resize the window or switch tabs to trigger a redraw.
  • Slow during large runs: reduce Auto‑flip ×N or disable animations.

Advanced Tips:

  • Tip Use seeded mode for demonstrations so everyone sees the same sequence.
  • Tip Encode group and date in the seed to organize repeatable sessions.
  • Tip Run 200 to 500 flips when teaching convergence toward the configured probability.
  • Tip Explore negative bias values to emphasize Tails in controlled experiments.
  • Tip Disable animations for faster bulk runs and smoother charts.
  • Tip Compare two runs by keeping all settings identical except the bias.

Glossary:

Bernoulli trial
Single experiment with exactly two outcomes.
Probability (p)
Expected long‑run frequency of an outcome.
Proportion
Observed frequency divided by total trials.
Bias
Intentional tilt of probability toward one outcome.
Seed
Initial value that makes a random sequence repeatable.
PRNG
Deterministic generator that simulates randomness.
Streak
Consecutive identical outcomes in a sequence.