Random Number Generator
Generate a cryptographically random number in any range.
Was this tool helpful?
Thanks for the feedback!
Set a minimum and a maximum, press Generate, and this tool picks one whole number from that range, with both ends included. It draws from your browser's cryptographic random source rather than an ordinary game-grade generator, which makes it suitable for lucky draws and anything where fairness may be questioned.
How the range is interpreted
- Whole numbers only. The minimum is rounded up and the maximum rounded down, so 1.2 to 5.9 becomes 2 to 5.
- Empty fields: a blank Max is treated as 100, and a blank Min as 0. The grey "1" in the Min box is only a hint, so type 1 if you want the range to start there.
- Negative numbers work, for example −50 to 50.
- Max must be at least Min, otherwise you get an error. Setting both to the same value always returns that value.
Every number in the range has the same chance: with 1 to 250, each has a 1 in 250 chance on every click. Clicks are independent, so the same number can appear twice in a row.
Why cryptographic randomness matters
Most quick random functions in browsers, such as JavaScript's Math.random(), are fast pseudo-random formulas. They are fine for games, but they were not designed to resist prediction. This generator uses crypto.getRandomValues(), which is seeded from your operating system's entropy sources and is the same facility browsers use for security keys.
The tool takes a random 32-bit value and maps it onto your range with a remainder operation. That introduces a tiny bias towards lower numbers when the range does not divide evenly into 2³², but for a range of a million numbers the effect is about 0.02 percent, far too small to matter for a draw.
Running a fair lucky draw
- Give every participant a number first, such as a token, ticket or roll number, and publish the list.
- Announce the range and the rules in advance, including what happens if a number is absent or comes up twice (usually, draw again).
- Generate the numbers in front of everyone or record your screen while you do it.
- Note each result immediately, one click per prize.
Other everyday uses
- Choosing which student answers next, by roll number.
- Picking random invoice or order numbers for an audit sample.
- Deciding a random page to revise from a textbook, or a random question from a numbered bank.
- Settling a turn order or a tie-break in a board game.
When you have names rather than numbers, the random picker chooses directly from a pasted list. For codes that will protect something, such as a lock or a card, the PIN generator is the better fit.