Advertisement

Coin flipper

Choose a seed and a head probability to generate an educational coin-flip sample. Change the seed to obtain a different sample.

Calculator

Change this whole number for a different reproducible sample.

Heads
5.000000
Tails
5.000000
Longest heads run
2.000000
Longest tails run
3.000000
Final generator state
2,007,237,709.000000
Flip results
FlipSide
1Heads
2Heads
3Tails
4Heads
5Tails
6Heads
7Heads
8Tails
9Tails
10Tails

Advertisement

How this calculator works

The seed initializes a Park-Miller pseudorandom sequence. Each generated value is mapped into [0,1) and compared with the chosen probability of heads. The same seed and settings always reproduce the same results, including after reset. This is a teaching simulation with a finite deterministic sequence. It is unsuitable for passwords, cryptographic keys, audited draws or gambling settlement.

Formula

State_next = (16807 × state) mod 2147483647. U = (state_next - 1)/2147483646. A flip is heads when U < p.

Worked example

With seed 1, a 50% head chance and five flips, the sequence is Heads, Heads, Tails, Heads, Tails. There are three heads and two tails, with a longest heads run of two.

Advertisement

Frequently asked questions

How do I flip again?

Change the seed. Changing only the number of flips extends or shortens the same reproducible sequence.

Does reset create a new sample?

Reset restores the default seed and settings, so it restores the same default sample.

Must a short sample be half heads?

No. A probability describes the generating model, not a fixed quota. Short sequences can have strongly uneven totals.

Sources

Advertisement