Coin flip
Flip a coin with cryptographically strong randomness: one flip or up to 1000 at once, with a custom heads probability, counts, streaks and recent results.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Flip settings
Randomness comes from the browser crypto.getRandomValues API, with rejection sampling so that no probability is biased by the modulo operation.
Result
Set the probability and count, then press a button to start flipping.
What this tool does
- Settle a decision when nobody will budge — the result comes from the browser’s cryptographic RNG rather than a hunch.
- Demonstrate probability: set heads to 60%, flip 200 times and see how far the observed share drifts from the setting.
- Check your intuition about streaks — over 100 flips the longest run is usually longer than people expect, which is a great way to explain randomness.
- Repeat an experiment quickly: batch flipping plus statistics beats tossing a real coin a hundred times.
Example
Input
Heads probability 100%, 5 flips (every flip must be heads)
Output
Total flips 5, heads 5, tails 0, heads share 100%, longest heads streak 5, longest tails streak 0, recent sequence H H H H H
A probability of 0 or 100 is a boundary case: the tool returns tails or heads outright without consuming any randomness. In practice you will usually leave it at 50%.
Frequently asked questions
Where does the randomness come from?
From crypto.getRandomValues, which is a cryptographically secure generator in the browser. Rejection sampling discards values that would bias the modulo, so even a probability like 33.33% does not favour one side.
How many flips can I run at once?
The count must be an integer from 1 to 1000; anything outside that is rejected before it runs. Single-flip mode adds one result to the running statistics, while batch mode starts a fresh set with the count you entered.
Why can 10 flips at 50% still produce 8 heads?
A probability only describes the long-run frequency. Eight heads in ten flips happens about 4.4% of the time, so it is far from rare — smaller samples wobble further from 50%, which is also why streaks look non-random. Use a few hundred flips to sanity-check a probability.
Are the results recorded or uploaded?
No. The numbers are generated locally and the statistics live in memory, the page makes no requests, and a refresh clears everything — there is no server-side record to worry about.
Why does the recent sequence show only part of the results?
The sequence text keeps the last 60 flips; anything older is hidden but still counted. That way a thousand flips do not flood the page with characters, while the shares and streak numbers still use every result.
Keywords:coin flipcoin tossrandomprobabilityheads or tails抛硬币掷硬币随机概率正面反面