Random Number Picker
Up to 1,000.
42
The generator draws numbers from a range you set, one at a time or up to a thousand at once, with the choice of allowing repeats or forbidding them. The numbers come from the browser cryptographic generator rather than Math.random, and the difference matters when a draw decides something.
How it works
Each number is drawn with crypto.getRandomValues using rejection sampling. Taking a random 32-bit value modulo your range would make low numbers fractionally more likely, because the range rarely divides the 32-bit space evenly, so values in the leftover tail are discarded and redrawn instead.
- With repeats allowed, every draw is independent: the same number can come up twice in a row, and over 100 draws from 1 to 100 roughly 37 of the numbers never appear at all.
- With repeats forbidden, the range is shuffled and the first n taken, which guarantees distinct values without repeatedly redrawing collisions.
- Asking for more distinct numbers than the range holds is refused rather than silently returning fewer.
- Very wide ranges switch to draw-and-reject, since materialising a range of ten million numbers to shuffle it would be far slower than redrawing the occasional collision.
Nothing here is seeded, so results cannot be reproduced. That is the right behaviour for a draw and the wrong behaviour for a simulation, if you need repeatable results, you need a seeded generator in your own code.
Examples
A single number
Range
1 to 100
Result
One number, each with a 1% chance
The bounds are inclusive at both ends, so 1 and 100 are both possible. Some pickers exclude the upper bound, which quietly changes the odds.
A lottery-style draw
Range
1 to 49
How many
6
All different
On
Result
Six distinct numbers
Without the all-different option the same number could appear twice, which is not how any draw of physical balls works.
Asking for too many
Range
1 to 5
How many
10, all different
Result
Refused, with the reason
Ten distinct numbers cannot come from a range of five. Saying so is more useful than returning five and leaving you to notice.
Frequently asked questions
Is this actually random?
It uses crypto.getRandomValues, which the browser seeds from operating system entropy, the same source used for cryptographic keys. It is not a mathematical pattern you could predict from previous draws, unlike Math.random, whose internal state can in principle be recovered from enough outputs.
Why did the same number come up twice?
Because independent draws are independent. With repeats allowed, drawing twice from 1 to 100 has a 1% chance of matching, and that surprises people far more often than the maths says it should. Turn on "all different" if you want a draw without replacement.
Are both the lowest and highest numbers included?
Yes, both ends are inclusive. A range of 1 to 100 can produce 1 and can produce 100, each with the same probability as any other value. This is worth checking on any picker, since excluding the top end is a common implementation slip.
Can I reproduce a particular draw?
No. There is no seed, so a result cannot be recreated. For anything that needs to be verifiable later, record the result rather than hoping to regenerate it, and for simulations that need repeatability, use a seeded generator in code.
Is it fair enough to decide something real?
For splitting a bill, picking a winner among friends or choosing an order, yes. For anything with money or legal weight, the problem is not the randomness but that nobody can verify the draw happened as described. Those need a process with witnesses or a published, auditable method.