How to use it
- Set From and To. Both bounds are included in the draw.
- Leave How many at 1 for a single number, or raise it to get a list.
- Tick no repeats for a draw without replacement, and ascending to sort the result.
Where the randomness comes from
From crypto.getRandomValues, the cryptographic source built into your browser, rather than Math.random. The raw value is rejection-sampled before being reduced to your range, which removes the modulo bias that makes naive generators favour the low end of a range. Over a long run the distribution is flat, and the page does not reseed between draws.
A draw without repeats is done by a partial Fisher-Yates shuffle when the range is small enough to hold in memory, and by rejection sampling when the range is huge and the count is small. Both give the same guarantee: every subset of the range is equally likely.
Limits worth knowing
- Up to 1000 numbers in one go.
- Both bounds are inclusive, so 1 to 6 can return 1 and can return 6.
- Without repeats you cannot ask for more numbers than the range holds, and the page says so rather than looping.
Questions
How do I get a random number between two values?
Type the lower bound in From, the upper in To, and press Generate. Both bounds can come up.
Can I draw without repeats?
Tick no repeats. Every number in the result is then distinct, which is what you want for picking winners or seats.
Is it good enough for a prize draw?
The source is the cryptographic generator in your browser, so the numbers are not predictable from each other. What it cannot do is prove to anyone else which number came up, so for a public draw use something with a verifiable seed.
Do my numbers leave the browser?
No. The bounds you type are remembered in local storage on your own device for your next visit, and nothing is sent to affpapa.org.