Random Number Generator

Pick random whole or decimal numbers in any range, with options for no repeats and sorted results.

42

🔒 Runs entirely in your browser. Nothing you enter is sent to a server.

Need to pick a raffle winner, choose who goes first, sample some data or settle an argument? This random number generator picks one number or thousands from any range you choose. It uses secure randomness and is carefully built so that every number in the range has exactly the same chance.

How to use the random number generator

  1. Enter the minimum and maximum. Both are included in the range.
  2. Choose how many numbers you need, up to 10,000.
  3. Pick whole numbers or up to four decimal places.
  4. Tick No repeats to make every number unique, and Sort results to list them in order.
  5. Click Generate, or press Enter in any box.

How it works

The generator draws random bits from crypto.getRandomValues, your browser’s secure random source. Turning random bits into a number in a range needs care. The common shortcut, random % range, slightly favours some numbers whenever the range doesn’t divide evenly into the number of possible random values. This tool uses rejection sampling instead:

limit = the largest multiple of range that fits in 2^53
repeat: x = 53 random bits
until x < limit
result = minimum + (x mod range)

Throwing away the few values above the limit removes the bias, so every outcome is exactly equally likely.

For decimals, the range is scaled up first. A range of 0 to 1 with two decimal places is treated as the whole numbers 0 to 100, and the result is divided by 100.

Worked example

You want three winners from 250 raffle tickets.

  • Set minimum 1, maximum 250, how many 3, and tick No repeats.
  • Each ticket has a 1 in 250 chance of being picked first. After that, each remaining ticket has a 1 in 249 chance, then 1 in 248.
  • The chance that one particular ticket wins any of the three prizes is 3 ÷ 250 = 1.2%.

Without “No repeats”, the same ticket could come up twice. The chance of at least one repeat among three draws is 1 − (250 × 249 × 248) ÷ 250³ ≈ 1.2%, small but real.

Common ranges

Purpose Settings
Roll a die 1 to 6
Flip a coin 0 to 1 (0 = heads, 1 = tails)
Pick a percentage 1 to 100
Lottery-style pick (6 from 49) 1 to 49, how many 6, no repeats, sorted
Random PIN digit 0 to 9
Random probability 0 to 1 with 4 decimal places

Tips

  • Shuffle a list. To randomise the order of n items, set the range 1 to n, how many n, and tick No repeats. The output is a random ordering.
  • Sample from data. To audit 20 rows out of 5,000, generate 20 unique numbers between 1 and 5,000.
  • Random is lumpy. Short runs of the same number, or several numbers close together, are normal in true randomness. They don’t mean the generator is broken.
  • For passwords, use the password generator instead, which builds random strings designed for security.

Frequently asked questions

Are these numbers truly random?

They come from your browser's cryptographically secure random number generator, the same source used to create encryption keys. It is unpredictable for all practical purposes, which is far stronger than the basic Math.random function many sites use.

Are the minimum and maximum included?

Yes. Both ends of the range can be picked. A range of 1 to 6 works exactly like a die, with each face equally likely.

What does "No repeats" do?

It makes sure each number appears at most once, like drawing numbered balls from a bag without putting them back. That is what you want for raffles and lotteries. You can't ask for more unique numbers than the range contains.

Can I use this for a giveaway or raffle?

Yes. Give each entry a number, set the range to cover all entries, and generate one number, or several with "No repeats" for multiple winners. For transparency, consider recording your screen while you draw.

Can it generate negative or decimal numbers?

Yes. Enter a negative minimum for negative numbers, and choose up to four decimal places. Every value at that precision is equally likely.

Last updated October 28, 2026 · By the ZTool team