Random number generator

Set a minimum and maximum, choose how many numbers you want, and press Generate. You can ask for no repeats and sorted results. Other modes pick winners from a list of names, flip coins and roll up to 10 dice. Every result uses your browser's cryptographic random generator, with no bias towards any number.

Free, no sign-up Runs in your browser

Settings

Result

How to use the random number generator

  • Numbers: enter a minimum and maximum (both included) and how many numbers you want, up to 10,000. Tick No repeats for a draw where each number can come up only once, like a raffle or lottery. Tick Sort to list them in order.
  • Pick from list: paste names, one per line, and choose how many winners to draw. Winners are listed in the order they were drawn, so the first is the main prize. Or shuffle the whole list to set a random order.
  • Coin flip: flip one coin, or up to 1,000, and see the count of heads and tails.
  • Dice: roll 1 to 10 dice with 4, 6, 8, 10, 12 or 20 sides, and get the total.

Use Copy to paste the result into a chat, a spreadsheet or an announcement.

Is it truly random?

The numbers come from crypto.getRandomValues, the cryptographically secure generator built into every modern browser. The browser seeds it from your operating system, which gathers unpredictable data from the hardware. It is the same source used to make encryption keys. Nobody, including us, can predict or influence a result, and nothing is sent to a server.

Plain Math.random(), used by many simple tools, is fine for games but is not designed to be unpredictable. It is not suitable for anything with prizes or money at stake.

No bias: rejection sampling

The browser gives random 32-bit numbers, from 0 to 4,294,967,295. A naive way to get a number from 1 to N is 1 + (x % N). But unless N divides 4,294,967,296 exactly, some results come up slightly more often than others. This is called modulo bias.

limit = 2³² − (2³² mod N) repeat: x = random 32-bit number until x < limit result = min + (x mod N)

Example: for N = 3 billion, values 0 to 1,294,967,295 can be reached in two ways with plain modulo, so the low third of the range would be twice as likely. Rejection sampling throws away any draw at or above the limit (3,000,000,000 here) and draws again. Every number from min to max then has exactly the same chance.

Odds for dice and coins

RollPossible resultsChance of eachAverage
CoinHeads, tails1 in 2 (50%)—
1d41–41 in 4 (25%)2.5
1d61–61 in 6 (16.7%)3.5
1d81–81 in 8 (12.5%)4.5
1d101–101 in 10 (10%)5.5
1d121–121 in 12 (8.3%)6.5
1d201–201 in 20 (5%)10.5
2d6 (total)2–127 is most likely (1 in 6)7

The average of one die with S sides is (S + 1) ÷ 2. With several dice, totals near the middle are more likely, because more combinations add up to them.

Tips for fair giveaways

  • Decide the rules and the number of winners before you draw, and say how duplicates are handled.
  • Remove duplicate entries first if each person may enter once. The tool tells you when the list has duplicates.
  • Record your screen or draw live, and post the winner list with the time shown under the result.
  • Draw a few extra names in order as reserves, in case a winner doesn't reply.

Need a random password or ID instead? Use the password generator or the UUID generator.

Frequently asked questions

How do I pick a random number between 1 and 100?
Leave min at 1, max at 100 and how many at 1, then press Generate numbers. Both 1 and 100 can come up, and every number has the same 1-in-100 chance.
Can I generate random numbers without repeats?
Yes. Tick No repeats. Each number in the range then appears at most once, like balls drawn from a bag. How many cannot be more than the count of numbers in the range.
How do I pick a random winner for a giveaway?
Choose Pick from list, paste the entrants one per line, set the number of winners and press Pick winners. Winners are drawn without repeats and listed in draw order.
Is this random number generator fair?
Yes. It uses the browser's cryptographically secure generator and rejection sampling, so every allowed result has exactly the same probability. Results are made in your browser and are not stored.
Can I use it for a lottery or a legal prize draw?
It is fine for informal draws. Official lotteries and regulated prize draws often have their own legal rules on how winners are chosen and witnessed, so check the rules that apply to you.

Last updated . How we check our tools.