A random number generator picks whole numbers at random between a minimum and maximum you choose. Set 1 to 100 to get one number where each value has a 1 in 100 chance.
On this page

How to use the random number generator
- Enter the minimum and maximum.
- Enter how many numbers you need.
- Press calculate to draw the numbers.
How the random number generator works
The random number generator picks whole numbers between a minimum and a maximum, including both ends. You set the minimum, the maximum and how many numbers you want. Each number is drawn separately as:
- n = min + (r mod (max − min + 1)), where r is a secure random 32-bit value
Values of r that would make some numbers more likely are thrown away and drawn again, so every whole number in the range has exactly the same chance on each draw. Because draws are separate, the same number can appear twice. Minimum and maximum must be whole numbers, and the maximum must not be less than the minimum.
Random number generator worked example
To pick a winner from 30 numbered raffle tickets, set the minimum to 1, the maximum to 30 and the count to 1. The random number generator returns one number, say 17, and each ticket had a 1 in 30 chance. To roll a die, use 1 to 6. To simulate ten coin flips, use 0 to 1 with a count of 10, reading 0 as tails and 1 as heads.
| Min | Max | Count | Use |
|---|---|---|---|
| 1 | 100 | 1 | one number, 1 to 100 |
| 1 | 6 | 1 | a die roll |
| 1 | 10 | 5 | five numbers, repeats possible |
| 0 | 1 | 10 | ten coin flips as 0/1 |
| 1000 | 9999 | 1 | a 4-digit number |
Where the randomness comes from
The tool uses the browser’s Web Crypto API, crypto.getRandomValues, which MDN describes as a source of cryptographically strong random values. It does not use Math.random, which MDN warns is not suitable for security. If a browser has no secure source, the tool shows a message instead of falling back to a weaker one. That makes it suitable for fair draws, sampling and games, and the output cannot be predicted from earlier results. For passwords, the password generator on this site uses the same source and also handles character sets for you.
Repeats and unique numbers
Each draw ignores the earlier ones, so asking for 5 numbers from 1 to 10 may give 3, 8, 3, 1, 10. That matches rolling dice, where repeats are normal. If you need unique numbers, as in a lottery draw or a random order, draw again whenever you get a repeat, or list the numbers and shuffle them. The chance of at least one repeat grows fast: with 23 draws from 1 to 365, it is just over 50%, the birthday problem.
How many numbers to ask for
Enter a whole-number count from 1 to 50. A count of 0, a negative count, a decimal or more than 50 is rejected with a message, so you never get an empty or runaway list. For more than 50 numbers, run the tool several times. The range itself can hold up to 4,294,967,296 values.
Fair draws
For a public draw, decide the range and rules before you press the button, and record the result. Ask someone to watch. Running the random number generator again until you like the answer defeats the purpose. If many people are involved, a simple written method, such as numbering entries in the order they arrived, makes the result easy to check.
Common uses
Teachers use a random number generator to call on students or split a class into groups. Researchers use random numbers to pick a sample from a numbered list so that every member has the same chance. Game makers use them for dice, cards and loot drops. In statistics classes, repeated random draws show how sample averages settle near the true mean as the number of draws grows.
To choose a random sample of 10 from 200 survey forms, number the forms 1 to 200, draw numbers until you have 10 different ones, and pick those forms.
Tips
- Both the minimum and maximum can be drawn.
- Negative ranges, such as −10 to 10, work.
- Use the password generator, not a list of numbers, when you need a password.
Related converters and calculators
Related calculators:
- Dice roller: roll dice
- Password generator: secure passwords
- Probability calculator: chances
- Permutation and combination calculator: counting
Sources
MDN Web Docs: Crypto.getRandomValues(); NIST CSRC: Random bit generation.
Formula and method
Each draw: min + (r mod span) with r from crypto.getRandomValues (32-bit), rejection sampling to remove bias; span <= 2^32; count 1 to 50.
Inclusive integer range. Requires max >= min. Not cryptographically secure; values change on every run.
Questions about this calculator
Can the same number come up twice?
Yes. Each draw is independent.
Are both ends included?
Yes, the minimum and maximum can both be drawn.
Is it secure?
It uses crypto.getRandomValues, a cryptographically strong source, with no bias.
How many numbers can I draw?
Up to 50 at a time.
Can I use negative numbers?
Yes.
Check the assumptions and units before relying on a result. Financial, tax and health estimates do not replace advice for your individual circumstances.
Report a calculation issue