Random number generator

Pick a range, say how many numbers you want, and choose whether they may repeat. Your settings are still here next time.

What are you drawing?

Result

Press draw and the numbers will appear here.

How it works

Each number is drawn from your browser's built-in generator, crypto.getRandomValues, and the range is inclusive at both ends — asking for a number between 1 and 10 really can give you 10. That sounds too obvious to mention, and it is one of the most common ways a generator is quietly wrong: an off-by-one at the top end is invisible unless you go looking for it.

There is one refinement worth naming because most implementations skip it. The generator produces a value from a range of 232 possibilities. If your range does not divide evenly into that — and most do not — simply taking the remainder makes the lowest few values very slightly more common than the rest. The fix is to discard the leftover block and draw again, which costs almost nothing and removes the skew completely.

All different, and why it is the interesting option

With all different switched on, no number can repeat within a draw. The obvious way to build that is to lay out the whole range, shuffle it and take the first few — which works fine for 1 to 100 and is impossible for 1 to a billion. That is the real reason many tools quietly cap how wide a range you may use.

This one uses a method that only tracks the positions it actually touches, so drawing ten distinct numbers from a range of a billion takes the same work as drawing ten from a range of twenty. The range can be as wide as you like without the page slowing down or the option disappearing.

When the request cannot be met

Ask for ten different numbers between 1 and 5 and there is no answer — there are only five numbers. The tool says so before you press the button, and names all three figures so you can see which one to change. It does not keep trying, and it does not quietly hand back five numbers as though that were what you asked for. A tool that retries forever in this situation is a page that appears to freeze.

Worked examples

Picking a winner from numbered entries

Forty entries numbered 1 to 40, one winner: set the range, leave the count at one, and draw. For three winners who must be different people, set the count to three and leave all different switched on.

Choosing a page, a track or a question

Set the range to the number of things you have and draw. This is the ordinary use, and the reason the range is remembered — most people come back to the same range repeatedly.

Generating test data

Up to a thousand numbers at once, repeating or not, copied out as text one per line. Useful for filling a spreadsheet column or seeding an example.

Splitting a bill or a chore by number

Draw one number per person from a range that matches your group, with repeats switched off so nobody gets the same slot.

Questions people actually ask

Are the numbers genuinely random?

They come from your browser's cryptographic generator, and the remainder skew that affects naive implementations is removed by rejection sampling. Every number in your range is equally likely.

Can I use this to choose numbers for a draw where money is involved?

You can generate numbers with it, but be clear about what that does: nothing here changes anybody's chances of anything. A random number is a random number, and no generator — this one or any other — can improve the outcome of a game of chance. If a tool suggests otherwise, it is selling you something that does not exist.

Are my numbers sent anywhere?

No. The drawing happens inside your browser and your range is stored on your own device using your browser's local storage. Nothing is uploaded and no server here ever sees a number.

Why does it remember my range?

Because most people use the same one repeatedly, and retyping it every visit is a small tax for no reason. It is the same idea as the saved lists on the other tools here.

Limitations, stated plainly

Related tools