Random Number Generator

Pick random numbers in any range, with or without repeats. Great for draws and lucky picks.

Both ends are included. Range up to 1,000,000,000,000.

Set a range and click Generate.

What this tool does

Enter a minimum and maximum, choose how many numbers you want, and click Generate. Both ends of the range are included, so 1 to 6 behaves like a die and 1 to 100 gives a hundred possible outcomes. Negative numbers work too (−10 to 10), and the range can be as wide as one trillion — enough for ticket numbers, transaction IDs or seeding a spreadsheet.

Tick Unique numbers only for a lucky draw, so nobody is picked twice, and Sort results when you want the list in ascending order for easy reading.

Where a fair random number matters

  • Lucky draws and raffles: number the entries, generate as many unique winners as there are prizes, and announce them in the sorted order or in draw order.
  • Picking a random sample: auditors, teachers and researchers use random numbers to select which invoices, students or survey responses to check.
  • Games: dice (1–6), a 20-sided die (1–20), lottery-style picks (6 unique numbers from 1–49), or choosing who goes first.
  • Testing: developers need random IDs, ports or delays to reproduce edge cases.
  • Decisions: flip a coin (0–1) or pick one of several options by numbering them.

For a draw that must stand up to scrutiny, publish the range and the list of entries first, generate in front of witnesses, and copy the result with the sort option off so the draw order is preserved.

How the numbers are generated

Each number comes from crypto.getRandomValues(), the browser’s cryptographically secure generator. For ranges up to 2³² the tool draws a 32-bit value; for bigger ranges it draws 64 bits and works in BigInt so nothing is rounded.

The obvious approach — random value modulo range size — subtly favours the low end of the range whenever the range does not divide 2³² exactly. Rejection sampling fixes this: any draw that falls into the leftover “unfair” slice at the top is thrown away and redrawn. The rejected share is always under 50% and usually tiny, so it costs nothing noticeable, and every number gets exactly the same probability.

When unique numbers are requested from a small range, the tool shuffles the whole range with a partial Fisher–Yates shuffle and takes the first N — the same method used to deal cards. For very large ranges it draws and discards duplicates instead, which is fast because the range is far larger than the count.

Example: 5 unique numbers from 1 to 49, sorted, might give 3, 17, 22, 38, 45. Each of the 1,906,884 possible combinations is equally likely.

Tips

  • If you only need one number, the result is shown large so it can be read from across a room.
  • The average, smallest and largest values are shown for multiple results; with enough draws the average should sit near the middle of your range, a quick sanity check of fairness.
  • Use “Copy results” to paste the list into Excel or Google Sheets; the comma-separated format splits neatly with Text to Columns.
  • The generator does not store anything, so keep a copy of any draw result you need to reference later.

Frequently asked questions

Is the random number generator fair?

Yes. It uses the browser's cryptographically secure random source with rejection sampling, so every number in the range has an equal chance.