Coin Flip, Dice & Random Number Simulator
Flip coins, roll dice (d6, d20, or any number of sides), and generate random integers in a range — using your browser’s cryptographically secure randomness.
Uses your browser’s cryptographically secure random generator (Web Crypto), with rejection sampling to avoid bias.
About this simulator
This tool generates fair random outcomes for three common needs: flipping coins, rolling dice with any number of sides, and producing random integers within a range. Unlike a typical script that relies on the ordinary Math.random, it draws from your browser’s Web Crypto API, which is seeded from the operating system’s entropy and produces cryptographically strong randomness. To keep every outcome equally likely it uses rejection sampling, discarding the small fraction of raw values that would otherwise bias the result toward lower numbers. Everything runs locally in your browser — nothing is uploaded — making it fast, private, and suitable for games, classroom demonstrations, raffles, and statistical sampling. The summary line reports useful aggregates like the heads/tails split or the sum and average of your rolls.
How to use it
- Pick a mode: coin, dice, or integers.
- Enter how many results you want (up to 10,000).
- For dice, set the number of sides; for integers, set the min and max.
- Click Generate and read the results and summary.
Frequently asked questions
- Is this random number generator truly random?
- It uses the Web Crypto API (crypto.getRandomValues), which provides cryptographically strong pseudo-random numbers seeded from the operating system’s entropy. That is far stronger than the ordinary Math.random and suitable for fair games, drawings, and sampling.
- How do you avoid bias in the dice and integer ranges?
- By rejection sampling. Naively taking a random 32-bit number modulo the range introduces a slight bias toward smaller values. The generator discards the few values that would skew the result, so every outcome in the range is equally likely.
- What dice can I roll?
- Any number of sides from 2 up to 1000 — standard d6 and d20, or custom dice like d3, d100, or a d7. Enter the number of sides and how many to roll; the tool also reports the sum and average.
- Can I use this for a giveaway or raffle?
- Yes. Set the integer mode to your range (for example 1 to the number of entrants) and generate one or more numbers. Because it uses cryptographic randomness, the draw is fair and unpredictable.
- Does it run on a server?
- No. All randomness is generated locally in your browser; nothing is sent to a server. That keeps it fast and private, and the results are not logged anywhere.
- Why are my coin flips not exactly 50/50?
- Random does not mean evenly split in small samples. Ten flips might give 7 heads; that is normal variation. As you flip more, the proportion drifts toward 50% — the law of large numbers — but short runs naturally vary.