gizmobench

Coin Flip Game

A coin flip game played as a series: pick three, five or seven rounds, flip one round at a time, and the first side to take the majority wins. This page opens on best of five, so heads needs three rounds to win it. Every round is its own draw from crypto.getRandomValues, the browser's own cryptographic generator, with heads and tails exactly as likely as each other, and the line under the coin says where the series stands after each round. The running tally underneath counts every flip of the session, whichever game it belonged to.

Best of 5
No rounds played yet. Best of 5, first to 3 wins.
Mode
Rounds
Heads
0
Tails
0
Heads share
0.0%
Longest run
none yet
Flips
0

Press Space to flip without reaching for the mouse. The count field takes any number of coins from 1 to 1000 in one throw, and pressing Flip again adds to the same tally, so the session itself has no ceiling. Best of plays one flip a round until a side takes the majority, which is why the round count has to be odd.

The spin decides nothing. Every flip is drawn from crypto.getRandomValues, the browser's own cryptographic generator, the moment you press Flip, and the coin then turns to show a result that is already settled. The draw is mapped onto the two faces by rejection sampling rather than a remainder, so neither face is favoured, and no flip is influenced by the flips before it: a run of five heads leaves the next flip at 50 to 50. The tally is there so you can watch that happen rather than take our word for it.
Accuracy. A fair 50 to 50 draw from the browser's own cryptographic randomness, never a pattern or a seed. It cannot know anything about the decision you are making with it.

Common questions

How does best of five work?
Five rounds are available, and the first side to win three of them takes the series, so a game can end after three rounds rather than always running to five. The line under the coin says where it stands after every round: "2 to 1 after 3 rounds. First to 3 wins." Once a side reaches three the series is decided and no further flip can change it, so Flip round stops and New game becomes the button to press.
Why does the number of rounds have to be odd?
Because an even series can end level and there would be no winner to report. A best of four that finishes two apiece has no majority, and inventing a tie-breaker would mean the page deciding something the coin did not. The round count therefore takes any odd number from 1 to 99, and an even one is refused with a message saying to pick 3, 5 or 7 instead.
Is each round as fair as a single flip?
Yes, and identically so: every round is one draw from crypto.getRandomValues mapped onto the two faces by rejection sampling, with no seed and no memory of the rounds before it. Being 2 to 0 down does not change the odds of the next round, which stay at 50 to 50. That is why the series is worth playing rather than simulating in your head.
Does the tally carry over between games?
Yes. The heads and tails counts, the heads share and the longest run are the session's, not the game's, so they keep counting across every series you play and are remembered in this browser until you press Reset tally. New game clears only the current series and leaves the tally alone. Nothing is uploaded either way.
Can I go back to flipping a pile of coins?
Yes. Switch the mode from Best of to Flip and the count field comes back, taking any number of coins from 1 to 1000 in a single throw. The two modes share one tally, so a hundred coins thrown after a best of five are added to the same running count.

A fair 50 to 50 draw from the browser's own cryptographic randomness, never a pattern or a seed. It cannot know anything about the decision you are making with it.