Random Number Generator
Generate fair, unbiased random numbers in any range using your browser’s
cryptographic generator (crypto.getRandomValues()) — with optional no-repeats,
decimals and sorting. Nothing is uploaded.
Last reviewed 2026-06-19.
How the randomness works
Every number is produced by crypto.getRandomValues(), the browser’s
cryptographically secure random source — the same entropy your operating
system uses for encryption keys. It is not seedable and cannot be predicted or reproduced.
For whole numbers we use rejection sampling: we draw a 32-bit value and discard
any draw that falls into the small “leftover” region that would otherwise make some
numbers slightly more likely than others. The result is a uniform distribution —
every value in your range is exactly equally likely, even when the range is not a power of two.
This is the bias that a naive Math.random() × range approach quietly introduces.
Common uses
| Use | Suggested settings |
|---|---|
| Giveaway / raffle winner | Range 1 to number of entrants, how many = number of winners, Unique on |
| Dice roll | 1 to 6 (or 1 to 20 for tabletop games) |
| Coin flip | 0 to 1 (0 = heads, 1 = tails) |
| Lottery-style draw | 1 to 49, how many = 6, Unique on |
| Random sample without replacement | 1 to population size, how many = sample size, Unique on |
| Random decimal (e.g. 0–1) | Min 0, Max 1, decimal places 2–4 |
Good to know
- Fair for draws. Because the distribution is uniform and unbiased, each entry has an equal chance — suitable for giveaways, prize draws and sampling.
- Unique vs with-repeats. Turn on Unique to draw distinct numbers (sampling without replacement); leave it off to allow repeats (independent draws).
- Range limits. Values are clamped to between −1,000,000,000 and 1,000,000,000, and up to 1,000 numbers per batch.
- Private. Generation is 100% in-browser — nothing is sent to a server, and it works offline.
Frequently asked questions
- Is this random number generator truly random?
- It uses your browser's crypto.getRandomValues() API, which draws from the operating system's cryptographically secure pseudo-random number generator (CSPRNG) — the same entropy source used by password managers and TLS. Unlike Math.random(), it is unpredictable and not seedable, so results cannot be reproduced or guessed. For integers we also apply rejection sampling so every value in your range is exactly equally likely (no modulo bias).
- Can I use this for a giveaway or raffle fairly?
- Yes. Assign each entrant a number (1 to N), set the range to 1–N, turn on “unique (no repeats)” if you are drawing several winners, and generate. Because every number in the range is equally likely and the draw is unbiased, it is a fair selection. For full transparency you can screen-record the draw or generate in front of participants — nothing is sent to a server, so the result is produced live on your device.
- What does “unique (no repeats)” do?
- With it off, each number is drawn independently, so the same value can appear more than once (like rolling a die repeatedly). With it on, every number in the output is different — useful for lottery draws, picking distinct winners, or sampling without replacement. If you ask for more unique numbers than the range can hold (e.g. 10 unique numbers between 1 and 5), the count is automatically capped to the range size.
- How is this different from Math.random()?
- Math.random() is a fast, non-cryptographic generator intended for things like animations or shuffling unimportant lists; its output is not guaranteed unpredictable and can be biased when scaled to a range with the modulo operator. crypto.getRandomValues() is cryptographically secure, and our rejection-sampling step removes the modulo bias entirely, so for a range that is not a power of two every value is still exactly equally likely.
- Can it generate decimal numbers?
- Yes. Set “decimal places” to 1–4 and the generator returns uniform decimal values across your range (for example a random number between 0 and 1 with 4 decimals). At 0 decimal places it returns whole integers using the unbiased integer path.
- Does anything leave my browser?
- No. Every number is generated locally using your device’s CPU and OS entropy. Nothing is uploaded, transmitted or logged, and the page keeps working offline once loaded.