Home / Calculators / Random Number Generator

Random Number Generator

Outsource the decision to mathematics: fair random numbers in any range, dice with any number of sides, and coin flips — all drawn from your browser's cryptographic random source, not a predictable formula.

—

Uses cryptographic randomness (crypto.getRandomValues) with rejection sampling — every outcome equally likely.

Overview

Humans are terrible at being random — we avoid repeats, favour middles, and see patterns in static. Computers are not much better by default: the classic random() function is a deterministic formula that merely looks unpredictable. This generator skips both traps by drawing from the operating system's entropy pool, the same cryptographic source browsers use for security keys.

Three modes cover the common needs: plain numbers in any range (with unique-only draws and optional sorting), dice with up to 20 dice and 100 sides, and coin flips one at a time or fifty at once. Rejection sampling removes the subtle modulo bias that naive implementations leave behind, so every outcome is genuinely equally likely.

What “random” really means to a computer

True randomness comes from physical unpredictability — thermal noise, timing jitter, the chaos of the real world — which the operating system harvests into an entropy pool. The browser's cryptographic random function draws from that pool, producing numbers no formula could predict. Contrast that with a pseudorandom generator: a fixed recipe that, given the same seed, replays the identical “random” sequence forever.

The second subtlety is fairness in mapping. Turning a huge random integer into, say, a number from 1 to 6 by simple remainder division favours low remainders slightly — modulo bias. Rejection sampling discards the biased leftovers and redraws, which is slower in theory and exact in practice. Every result this tool shows has passed through that correction.

Features

Benefits

Who can use it

Tabletop gamers rolling odd-sided dice, teachers picking names fairly, raffle organisers drawing winners, developers needing test data, and friends settling any dispute a coin can resolve. Statisticians will appreciate the rejection sampling; everyone else just gets fairness for free.

How to use

  1. Pick Numbers, Dice or Coin mode.
  2. Set the range, dice count and sides, or flip count.
  3. Toggle unique-only or sorting for number draws.
  4. Press generate and read — or copy — the results.
  5. For impossible requests, read the plain-English explanation instead.

Frequently asked questions

Why not just use Math.random()?

Because Math.random() is pseudorandom — a deterministic algorithm that replays the same sequence from the same seed. It is fine for shuffling a playlist, but for draws, sampling or anything where fairness matters, you want the operating system's entropy pool, which gathers real-world unpredictability. This tool uses the cryptographic source, so its outputs cannot be predicted or replayed.

What is modulo bias?

The small unfairness from naive range-mapping. If your random source gives 0–255 and you take the remainder mod 6, the values 0–3 appear slightly more often because 256 is not divisible by 6. Rejection sampling fixes it by discarding the leftover values and drawing again — a tiny cost for exact fairness, which this tool pays on every draw.

Can I draw unique lottery numbers?

Yes — enable unique-only and set the range, e.g. 6 unique numbers from 1 to 49. The tool draws without replacement, exactly like balls from a drum. If you ask for something impossible, like 10 unique numbers from 1–5, it explains the problem instead of hanging or repeating. If you ask for something impossible, like 10 unique numbers from 1 to 5, it explains the problem instead of hanging.

Are the dice fair for any number of sides?

Yes. Whether you roll a d6 or a d100, every result comes from the same cryptographic entropy source and passes through the same rejection-sampling correction that removes modulo bias. Up to 20 dice can be rolled at once, with automatic totals. Ironically, these digital dice are fairer than most physical ones, which carry tiny manufacturing imperfections — mathematics has no uneven edges.

Is my draw recorded anywhere?

No. Each draw happens entirely in your browser's memory using its cryptographic random source, and the results are never sent to a server, stored in a database, or logged anywhere. Refresh the page and the draw is gone for good — there is no history to leak, which is precisely the point of a private random generator.

Conclusion

Randomness is one of the few things worth getting exactly right. Draw from the operating system's entropy pool, correct the modulo bias with rejection sampling, and let mathematics settle the argument — whether it is a raffle, a dice roll, or the age-old question of who goes first.

Related tools

CalculatorsStopwatch & TimerPrecision stopwatch with laps — plus countdown alarm. CalculatorsPercentage CalculatorDiscounts, shares and change — three calculators in one. TextTyping Speed TestMeasure your typing speed and accuracy live.