Random Number, Dice & Coin Flip
Generate random integers, roll N dice with D sides, or flip N coins; uses cryptographic randomness.
- random
- rng
- dice
- roll
- coin
- flip
- integer
- d6
- d20
- d&d
About Random Number, Dice & Coin Flip
Three flavours of "I need a random number." Random integer for everything from picking a draw winner to seeding test data. Dice for tabletop gaming — single d20s, d6 pools, or polyhedrals up to d100 for percentile rolls. Coin for tie-breakers, simple two-choice decisions, and the classic "how many heads in N flips" demonstration of binomial distribution.
All three use the browser's cryptographic random source (Web Crypto's getRandomValues) and rejection sampling to avoid modulo bias, so the output is uniformly distributed across the requested range — not just "close enough for game night," but actually statistically uniform.
How to use
Pick a tab. **Integer**: set min, max, and count; tick "Unique values only" if you want a draw-without-replacement (e.g. choose 6 lottery numbers from 1–49). **Dice**: pick the number of dice and sides per die — the result shows each individual roll and the sum. Quick-pick buttons cover the standard polyhedral set (d4, d6, d8, d10, d12, d20, d100). **Coin**: pick the number of flips; the result shows each flip in sequence and totals of heads and tails.
Each result panel updates only when you click the action button — so a session of random rolls or flips stays visible until you reroll. The URL preserves your input settings (range, dice count, etc.) but not the rolled values.
Frequently asked questions
Is this actually random, or pseudo-random?
The randomness comes from the browser's Web Crypto API, which on modern systems pulls entropy from the OS's cryptographically-secure RNG (CSPRNG). That's the same source used for generating crypto keys, UUIDs, and session tokens. It's suitable for lotteries, draws, and any case where statistical fairness matters. It is not "true" hardware randomness from a quantum source, but for practical purposes the distinction is academic.
Why use crypto.getRandomValues instead of Math.random?
Math.random is fine for animations and games where statistical bias doesn't matter, but its implementation isn't specified — different browsers use different algorithms with different distribution properties. crypto.getRandomValues is guaranteed to be CSPRNG-grade everywhere, and rejecting samples that would introduce modulo bias keeps the distribution uniform across the requested range.
What's "unique values only" useful for?
Drawing without replacement — picking N items where no item can repeat. Common uses: lottery numbers (6 distinct numbers from 1–49), randomised participant orderings, shuffling a deck of cards, or picking a sample of M unique items from a list of N. If you ask for more unique values than the range allows, the calculator shuffles the entire range and returns it.
What's d20 and why do tabletop games use it?
d20 is a 20-sided die — the icosahedron, the most-faced of the five Platonic solids. Dungeons & Dragons and its descendants centre most rolls on a single d20, which gives a flat uniform distribution from 1 to 20 (each outcome 5% likely). For "sum of dice" rolls (3d6, 2d10, etc.), the distribution becomes a bell curve around the mean, which is why ability scores rolled with 3d6 cluster around 10–11.
How many flips do I need to get 50% heads?
A single coin flip is 50/50, but the observed proportion in a small sample can wander far from 50%. Roughly: with 10 flips, you might see anywhere from 3 to 7 heads commonly (a ±20% range). With 100 flips, the spread tightens to about 40–60 heads. With 1,000 flips, almost always 470–530. The Law of Large Numbers guarantees convergence to 50% only as the count grows without bound; "should be close to 50%" is a statement about long-run averages, not short samples.
More Generators tools
UUID Generator
Generate one or many cryptographically-random UUIDs (v4) in seconds.
Password Generator
Strong, random passwords with configurable length, charset, and entropy estimate.
Lorem Ipsum Generator
Generate placeholder text by paragraphs, sentences, or words.
QR Code Generator
Generate a QR code from any text or URL; download as PNG or SVG with custom colours and error correction.