Random Number Generator

Any range, with or without repeats, from the browser cryptographic random source.

Numbers

Press Generate to produce a set.

What this is good for, and where it is not enough

The numbers are drawn from crypto.getRandomValues, the browser's cryptographic random source, so as numbers they are sound. Picking a winner, choosing a sample, seeding a test, settling an argument: all fine.

Where it falls short is proof, and that is worth being plain about. Nobody watching a draw on your screen can verify which numbers came up, or that the page was not simply reloaded until it produced a convenient answer. That is a property of any generator running privately in a browser, not a flaw in this one. If a draw has to stand up to scrutiny, run it in front of the people it affects, or use a service that publishes a seed and a method others can check afterwards.

Both ends are included

A range of 1 to 10 can produce 1 and can produce 10. This sounds obvious and is a genuinely common bug: a generator built on a naive expression usually makes the top of the range unreachable, so the highest number never appears and nobody notices until someone counts.

Drawing without repeats

No repeats draws without replacement, which is what a raffle, a lottery line or a random sample needs. It requires the range to contain at least as many numbers as you asked for; ask for 20 numbers between 1 and 10 and the tool says so rather than looping forever trying to find them.

Leaving it off draws with replacement, which is right for anything modelling independent events, such as rolling a die repeatedly. Repeats are then not a fault: in six rolls of a die, seeing the same face twice is the ordinary outcome rather than a surprising one.

The bias most generators have

Turning a random value into a number in a range is where simple implementations go wrong. Take a value from a large pool and apply a remainder to squeeze it into a smaller range, and unless the range divides the pool evenly, the lower numbers come up slightly more often than the higher ones. The effect is small and completely invisible in casual use, and it is real.

The fix is to discard the values that would cause it and draw again. That is what happens here, which is why every number in the range is genuinely equally likely rather than nearly so.

Decimals

With Decimals on, values are drawn across the range and rounded to the number of places you choose. Rounding means the two ends of the range are very slightly less likely than the middle, since only half the interval either side rounds onto them. It makes no practical difference at two decimal places over a range of any size, but it is the honest description of what the option does.

How to use it

Set the range and how many you want, then press Generate. Every option redraws immediately. Sort ascending orders the results, which is convenient for a lottery line and pointless for a sequence where the order is the point. Copy all puts the whole set on the clipboard one per line.

Questions

Is this random enough for a prize draw?

The numbers themselves are, because they come from the browser cryptographic random source rather than Math.random. What a web page cannot give you is proof: nobody watching can verify which numbers were drawn or that the draw was not repeated until it gave a convenient answer. For a draw that has to be defensible, run it in front of witnesses or use a service that publishes a verifiable seed.

What does no repeats do?

It draws without replacement, so each number appears at most once, which is what a raffle or a lottery line needs. It requires the range to hold at least as many numbers as you asked for, and the tool says so rather than looping forever when it cannot.

Are both ends of the range included?

Yes. A range of 1 to 10 can produce both 1 and 10. Off-by-one at the top is a common flaw in simple generators, and it quietly makes the highest number impossible.

Why not just use Math.random?

For a game it is fine. It is not a cryptographic generator, so its output is predictable from previous values, which matters for anything anyone might want to game. There is also a subtler flaw in most implementations: reducing a random value into a range with a plain modulo makes the lower numbers slightly more likely. Those values are discarded and redrawn here.

Is anything sent to a server?

No. Numbers are drawn inside your browser and this tool has no backend, so nothing is transmitted, logged or stored.