Skip to content
Case Converter Online
en

Random Number Generator

Pick a random number between any two values, or draw a whole set at once. Turn on No repeats for lottery style draws.

Options

Result

Recent results

  1. Your last 10 results appear here. They are kept only until you leave the page.

What this random number generator does

It picks whole numbers or decimals at random from a range you choose. You can draw one number, such as a winner for a raffle ticket, or thousands of numbers for test data, a classroom game or a sample. Every number in the range has exactly the same chance of being chosen, and both ends of the range are included.

Everything happens in your browser. No numbers are sent to a server, and nothing is saved after you leave the page.

How to use it

  1. Enter the lowest allowed value in Minimum and the highest in Maximum. Negative numbers work.
  2. Set How many numbers you want. The limit is 10,000.
  3. Choose Decimal places. Keep “None (whole numbers)” for integers.
  4. Pick an Order: “As drawn”, “Smallest first” or “Largest first”.
  5. Turn on No repeats if each number may appear only once.
  6. Choose how to Separate results with: new line, comma and space, space, comma or nothing.
  7. Press Generate numbers.

A single number is shown in large type under Result. A list appears in a box you can scroll. Press Copy to copy it all. Your last ten draws are listed under Recent results, each with its own Copy button. Press Clear to empty that list. It is only kept until you leave or reload the page.

Examples

These came from real runs of the tool’s code. Your results will differ, which is the point.

Settings One run gave
1 to 100, one number 74
1 to 6, five numbers (dice rolls) 5, 4, 1, 5, 2
1 to 49, six numbers, No repeats, Smallest first 6, 12, 19, 24, 27, 33
0 to 1, three numbers, 2 decimal places 0.45, 0.44, 0.63
-10 to 10, five numbers, Largest first 6, 5, 3, -7, -7
1000 to 9999, three numbers, No repeats 7292, 7269, 5088
1 to 10, ten numbers, No repeats 9, 5, 2, 10, 3, 4, 1, 7, 8, 6

The last row is a full shuffle of 1 to 10. Asking for ten unique numbers from a range of ten gives every number once, in random order.

How it works

The tool asks your browser for random bits with crypto.getRandomValues. Turning those bits into a number in your range needs care. The obvious shortcut is to take a big random number and use the remainder after dividing by the size of the range. That shortcut is slightly unfair: some results come up more often than others whenever the range does not divide the random source evenly. This is called modulo bias.

To avoid it, the generator uses rejection sampling. It works out the largest block of random values that splits evenly into your range. If a draw lands outside that block, it is thrown away and a new one is drawn. Rejections are rare, so this is still instant, and every number in the range ends up equally likely.

For decimals, the range is scaled up. A range of 0 to 1 with two decimal places becomes a draw from 0 to 100, which is then divided by 100. This keeps decimal results fair too.

With No repeats, the tool makes sure no value is picked twice. Small ranges are shuffled and the first values taken; large ranges are drawn one value at a time, skipping any value already picked. Either way the result is a fair sample without replacement, whether the range is 1 to 10 or 1 to a billion.

Tips and limits

  • Both ends count. A range of 1 to 6 can return 1 and 6, like a real die.
  • Repeats are normal. Without No repeats, getting the same number twice is expected. In the dice row above, 5 came up twice in five rolls.
  • Range too small. If you ask for more unique numbers than the range holds, you get a message instead of a short list.
  • Very wide ranges. The gap between Minimum and Maximum can be up to about 9 quadrillion (2 to the power 53). Very wide ranges with many decimal places may hit that limit and show a message.
  • Not for regulated draws. The generator is fair, but official lotteries and prize draws often need audited hardware or a witness. Check the rules that apply to you.
  • Need passwords? Use the strong password generator, which mixes letters, numbers and symbols.

Other ways to get random numbers

Excel and Google Sheets. =RANDBETWEEN(1,100) returns one whole number from 1 to 100. In current Excel, =RANDARRAY(10,1,1,100,TRUE) fills ten cells. The values change every time the sheet recalculates, so paste them as values if you need to keep them.

Python. random.randint(1, 100) is fine for games and simulations. For anything security related, use secrets.randbelow(100) + 1, and use random.sample(range(1, 50), 6) for unique picks.

JavaScript. Math.random() is quick but not designed to be unpredictable. Use crypto.getRandomValues with rejection sampling, as this page does, when fairness matters.

Command line. On Linux and macOS, shuf -i 1-100 -n 1 prints one number from 1 to 100.

To put a list of numbers in order, use the number sorter. To pick a name or an option from a list instead of a number, try the random choice generator. For random days in a date range, use the random date generator.

Random Number Generator: questions and answers

How do I pick a random number between 1 and 100?

Leave Minimum at 1 and Maximum at 100, keep How many at 1, then press Generate numbers. Both 1 and 100 can come up, and every number in between has the same chance.

Can I get random numbers with no duplicates?

Yes. Turn on No repeats before you press Generate numbers. Each value then appears at most once. If you ask for more numbers than the range holds, such as 6 numbers from 1 to 5, the tool tells you the range is too small.

Is this random number generator truly random?

It uses crypto.getRandomValues, the random source browsers provide for security work, which is seeded by your operating system. It is not a physical dice roll, but it is unpredictable and far better than the simple Math.random function used by many sites.

Can it make decimal numbers?

Yes. Set Decimal places to between 1 and 6. With a range of 0 to 1 and 2 decimal places, one run gave 0.45, 0.44 and 0.63.

Is there a limit on how many numbers I can generate?

You can generate up to 10,000 numbers in one go. The gap between Minimum and Maximum can be up to about nine quadrillion, which covers any practical use.