Text & Developer tool

Random Number Generator Online

Pick random whole numbers between any two values, with or without repeats.

  • Instant results
  • Working shown
  • No sign-up
  • Runs in your browser
ToolUpdates as you type

Numbers come from your browser's secure random generator (crypto.getRandomValues), and every whole number in the range is equally likely. Minimum and maximum are both included.

How it works

This random number generator picks whole numbers between a minimum and maximum you choose, with both ends included. Set how many numbers you want, tick No repeats to get all different numbers, and copy the result. It uses your browser's secure random source, so every number in the range is equally likely.

This random number generator picks random whole numbers between any two values. Use it to pick a roll number, choose a winner, roll a dice, or make test data for a program.

How to use the random number picker

  1. Click a quick range such as 1 to 100, or type your own Minimum and Maximum.
  2. Enter How many numbers you want.
  3. Tick No repeats if every number must be different, and Sort smallest first if you want them in order.
  4. Click Generate.
  5. Copy the result, separated by commas, spaces or new lines.

Recent short results stay listed under the tool until you leave the page, so you can look back at an earlier draw.

Generate a random number between any two values

Both the minimum and maximum are included. With minimum 1 and maximum 6, each of 1, 2, 3, 4, 5 and 6 has the same 1 in 6 chance, like a real dice.

Use Minimum Maximum Count No repeats
Random number 1 to 100 1 100 1 Either
Roll a dice 1 6 1 Either
Pick 5 students from a class of 60 1 60 5 Yes
Shuffle the order of 10 presenters 1 10 10 Yes
4-digit number 1000 9999 1 Either
Test marks for 30 students 0 100 30 No

Negative numbers work too. A range of -10 to 10 can give any whole number from -10 to 10, including 0.

Common mistake: A common mistake is asking for more unique numbers than the range holds. From 1 to 10 there are only 10 different whole numbers, so 11 numbers with No repeats is impossible. The tool tells you when this happens.

How the generator works

The tool asks your browser's crypto.getRandomValues for random bits. To turn them into a number in your range without favouring any value, it throws away the rare draws that would make some numbers more likely, a method called rejection sampling. For no-repeat draws it uses a partial Fisher-Yates shuffle, so every set of numbers is equally likely.

You can do the same in code:

Language Random whole number from 1 to 100
JavaScript Math.floor(Math.random() * 100) + 1
Python random.randint(1, 100)
Java new Random().nextInt(100) + 1
C rand() % 100 + 1 (slightly biased, fine for practice)

In Python, random.sample(range(1, 101), 6) picks 6 different numbers from 1 to 100. Note that Python's randint includes both ends, but range(1, 101) stops before 101.

Math.random and Python's random are fine for games and practice. For passwords and security tokens, use a secure source such as crypto.getRandomValues in JavaScript or Python's secrets module, as the password generator does.

Practise with random numbers

Random numbers make good test data. Generate 20 numbers from 1 to 100, paste them into a program and try:

  • Finding the average and checking it against your code.
  • Testing whether each number is prime.
  • Playing FizzBuzz on them.

Pro tip: When testing a sorting or searching program, use No repeats for one test and allow repeats for another. Duplicate values break more programs than you would expect.

Frequently asked questions

How do I generate a random number between 1 and 100?
Click the '1 to 100' button, or type 1 as the minimum and 100 as the maximum, then click Generate. Both 1 and 100 can come up.
What does No repeats do?
Each number can appear only once in the result, like drawing slips from a box without putting them back. You cannot ask for more numbers than the range holds, for example 11 different numbers from 1 to 10.
Are these numbers truly random?
They come from crypto.getRandomValues, the secure random generator built into your browser, and the tool avoids the small bias that simple methods add. That is good enough for classroom draws, games and practice data. For official lotteries, follow the rules of the organiser.
Can I pick a random roll number or name from a list?
Yes, for roll numbers. Number your list from 1 to N, set that range and pick as many as you need with No repeats. The number shows which name to choose.
How many numbers can I generate at once?
Up to 10,000 at a time. For long lists, choose new line as the separator and copy them into a spreadsheet.

Try another tool

See all free tools
Chat with us