EthicalFusion

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

  1. Give every participant a number first, such as a token, ticket or roll number, and publish the list.
  2. Announce the range and the rules in advance, including what happens if a number is absent or comes up twice (usually, draw again).
  3. Generate the numbers in front of everyone or record your screen while you do it.
  4. 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.

Frequently asked questions

Are the minimum and maximum included in the result?
Yes. With a range of 1 to 10, both 1 and 10 can be drawn, and every number between them has an equal chance.
Can it generate several numbers at once?
No, it returns one number per click. Click again for each extra number and skip any repeats if you need unique results.
Can the same number come up twice?
Yes. Each click is independent, so repeats are possible, just as a die can roll the same face twice.
Is this generator truly random?
It uses the browser's cryptographically secure generator, seeded from system entropy, which is unpredictable enough for draws and security uses.
Why did I get 0 when my range starts at 1?
The 1 shown in the Min box is only a placeholder. If the field is left empty the minimum is 0, so type 1 explicitly.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.