Random Number Generator
Generate random numbers in a range using the browser's cryptographic source, with no modulo bias.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the Random Number Generator does
The random number generator on this page will generate random numbers in a range using the browser's cryptographic source, with no modulo bias. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for picking numbers for a draw or a game. There are more free online tools on FreeToolsWorld.org.
How to use it
- Set the minimum and maximum, both inclusive.
- Set how many numbers you want.
- Turn on "no repeats" if each value must be distinct.
- Re-run the tool for a fresh set.
How it works
This uses crypto.getRandomValues with rejection sampling rather than Math.random. The distinction matters for two reasons. Math.random is not required to be cryptographically secure and its quality varies between engines. And the common shortcut of taking a random number modulo the range introduces a measurable bias towards low values whenever the range does not divide evenly into 2³² — rejection sampling discards the out-of-range values instead, which removes the bias entirely.
The repeat probability is shown because it surprises people. Drawing ten numbers from 1 to 100 with repeats allowed gives a 37% chance of at least one duplicate — the same birthday-problem arithmetic that makes shared birthdays in a room of 23 people a coin flip. If you need distinct values, turn repeats off rather than hoping.
Everything happens in the page. For a prize draw that matters, that is a mixed blessing: the draw cannot be influenced by a server, and it also leaves no record. Where an audit trail is needed, a documented procedure with witnesses is worth more than any generator.
True randomness from hardware entropy is a different thing again. The browser's generator is a cryptographically secure pseudorandom generator seeded from the operating system's entropy pool, which is unpredictable in practice and deterministic in principle. For everything short of cryptographic key generation that distinction does not matter.
When to use it
- Picking numbers for a draw or a game.
- Generating test data within a range.
- Choosing a random sample of row numbers from a dataset.
- Settling a decision between numbered options.
Common mistakes to avoid
- Allowing repeats when distinct values are needed — ten draws from 1 to 100 duplicate 37% of the time.
- Using a modulo-based generator, which biases towards low values.
- Using this where an auditable draw is required. It leaves no record.
Frequently asked questions
Is this truly random?
It uses the browser's cryptographically secure generator with rejection sampling, so every value in the range is equally likely. That is as good as randomness gets in a browser.
Why might I get duplicates?
Because repeats are allowed by default. Drawing ten numbers from 1 to 100 produces at least one duplicate 37% of the time. Turn repeats off for distinct values.
What is modulo bias?
Taking a random 32-bit value modulo a range favours low values whenever the range does not divide 2³² evenly. Rejection sampling discards out-of-range values instead, which removes the bias.