Random Number Generator

Any range, any quantity, drawn from a cryptographic source with no modulo bias.

Most online random number generators call Math.random and take the remainder, which produces numbers that are neither unpredictable nor quite evenly distributed. This one draws from the same cryptographic source browsers use for encryption keys, and rejects the draws that would tilt the distribution — so every value in the range really is equally likely.

How it works

1

Set the range

Any two whole numbers, in either order.

2

Choose how many

One draw, or up to a thousand at once.

3

Pick the rules

Allow repeats or forbid them, and sort the result if you like.

Where most random number generators go slightly wrong

The usual approach is to take a random value and use the remainder after dividing by the size of the range. If the source produces numbers from 0 to 9 and you want a range of 3, the remainders come out as 0,1,2,0,1,2,0,1,2,0 — zero appears four times, one and two three times each. The result is real but uneven, and the effect is called modulo bias.

With a 32-bit source and a small range the skew is a few parts per billion, invisible in a raffle and unacceptable in a simulation or anything security-related. The fix is rejection sampling: discard any draw that falls in the incomplete final block and try again. It costs a few extra draws and removes the bias entirely, which is what this generator does.

The source matters as much as the method. Math.random is a fast pseudorandom generator seeded from the environment, and its output is predictable to anyone who can observe enough of it — fine for shuffling a playlist, unfit for anything where guessing the next value has value. This tool uses crypto.getRandomValues, which draws from the operating system’s entropy pool.

Drawing without repeats, and what "random" does not guarantee

Forbidding repeats is a different problem from drawing one number. The naive method — draw, check, redraw on a collision — gets slower as the pool empties, and drawing 99 unique values from a range of 100 spends most of its time rejecting. This generator instead shuffles the range with a partial Fisher-Yates pass, which takes each value at most once and never retries.

What no generator can offer is a result that looks random to a human. Genuine randomness produces clusters: in six draws from 1 to 49, a pair of adjacent numbers appears far more often than intuition suggests, and a run of three is unremarkable. A sequence with no clumps at all is a sign of a generator that has been tampered with to look fair.

Nor does any of this make a result verifiable. Anyone watching a number appear on a screen has to trust the page that produced it, which is fine for choosing a restaurant and not fine for a public prize draw. Those need a procedure that can be audited afterwards — published seeds, sealed entries, or an observed physical draw — and no web page can supply that on its own.

Frequently Asked Questions

It uses crypto.getRandomValues, which draws from the operating system’s entropy pool and is designed to be unpredictable. That is cryptographically secure randomness, not the pseudorandom Math.random.
The uneven distribution you get by taking a remainder to fit a random value into a range. Values at the low end come up slightly more often. This tool discards the draws that would cause it.
Yes. Tick "No repeats" and each value can appear only once. The range must contain at least as many values as you are asking for, or the tool says so.
Up to a thousand per draw. There is no daily limit and no account, so generate as many batches as you need.
For something informal, yes. For a draw that must be provably fair to others, no web page can help — the result cannot be audited afterwards. Use a procedure with published seeds or observed physical selection.