Random Number Generator
A fair random number generator gives every value in the range the same chance, so each whole number from 1 to 100 has exactly a 1 in 100 (1%) chance of being picked. Numbers are drawn in your browser with the Web Crypto API, and you can block repeats for raffles, draws and random samples.
By the Calculators With Steps team · Updated November 10, 2026 · How we check our math
Your result is generated privately in your browser.
How to use the random number generator
Enter the smallest and largest number you want, choose how many to generate (1 to 1,000), and press Generate. Each press gives a fresh draw. Options:
- Whole numbers or decimals. For decimals, choose 1 to 10 decimal places. A range of 0 to 1 with 2 places can produce 0.00, 0.01 and so on up to 1.00, each equally likely.
- Allow repeats. Off by default, so each number appears at most once, like a raffle. Turn it on for things like dice rolls, where the same value can come up again.
- Sort. Lists the results from smallest to largest, handy for lottery-style picks. Leave it off to keep the order they were drawn in, which matters when the first number drawn wins first prize.
The results come with the sum and mean, and long lists appear in a table and as comma-separated text you can copy.
| You want | Min | Max | How many | Repeats |
|---|---|---|---|---|
| A number from 1 to 10 | 1 | 10 | 1 | either |
| A number from 1 to 100 | 1 | 100 | 1 | either |
| Roll two dice | 1 | 6 | 2 | allowed |
| Flip a coin (1 = heads) | 0 | 1 | 1 | either |
| Lottery-style 6 from 49 | 1 | 49 | 6 | off, sorted |
| 3 raffle winners from 250 tickets | 1 | 250 | 3 | off |
How the generator keeps every number equally likely
The numbers come from crypto.getRandomValues, the cryptographically secure random source built into every modern browser. The draw happens on your device, and nothing is sent to a server.
Turning random bits into a range takes care. A common shortcut is to take a random 32-bit integer and use the remainder after dividing by the size of the range. There are 4,294,967,296 possible 32-bit values, which is 42,949,672 × 100 + 96. So for a 1 to 100 range, the remainder method makes 96 of the numbers very slightly more likely than the other 4. That “modulo bias” is tiny for small ranges but large for big ones: for a range of 3 billion values, the first 1,294,967,296 would come up twice as often as the rest.
This generator uses rejection sampling instead. It throws away the few raw values that fall in the uneven leftover zone and draws again, so every number in your range has exactly the same probability. For draws without repeats, it either shuffles the range with a Fisher–Yates shuffle or redraws any number that has already appeared.
True random vs pseudo-random numbers
A pseudo-random number generator (PRNG) is a formula that produces a sequence that looks random from a starting value called the seed. The classic example is the linear congruential generator, X(n+1) = (a × X(n) + c) mod m. The same seed always produces the same sequence, which is useful for repeatable simulations but bad for anything that must be unpredictable. Spreadsheet functions such as RAND and the Math.random function in JavaScript are pseudo-random.
A true random number generator measures a physical process, such as electrical noise or radioactive decay. A cryptographically secure PRNG, which is what this page uses, sits in between: the operating system collects unpredictable events (timing jitter, hardware noise) to seed a generator that is designed so its output cannot be predicted, even by someone who has seen earlier numbers. That standard protects passwords and encryption keys, which is why the password generator on this site uses the same source.
Using random numbers fairly
- Raffles and giveaways: give each entry a number, generate without repeats and publish the settings you used. The order of the results gives first, second and third place.
- Random samples: to survey 20 people from a list of 500, number the list and draw 20 numbers from 1 to 500 without repeats. Every group of 20 is equally likely, which is what makes the sample unbiased.
- Classroom and games: pick a student, assign teams or roll virtual dice with repeats allowed.
- Expect streaks. Random results often look less random than people expect. With 10 draws from 1 to 100 and repeats allowed, there is a 37.18% chance of a duplicate. The probability calculator shows how to work out chances like these.
This tool is for everyday picks, games, teaching and sampling. Regulated lotteries and gambling use certified hardware and audited procedures.
Random Number Generator: frequently asked questions
How do I pick a random number between 1 and 100?
Leave the minimum at 1 and the maximum at 100, set how many to 1 and press Generate. Each of the 100 numbers has exactly a 1 in 100 (1%) chance of being picked.
How do I generate random numbers with no repeats?
Leave Allow repeats unticked. The generator then draws without replacement, like pulling numbered balls from a bag. To shuffle a whole range, such as 1 to 100, ask for as many numbers as the range holds: 100.
Is this random number generator truly random?
It uses your browser's cryptographically secure generator (crypto.getRandomValues), which the operating system seeds from unpredictable events on your device. It is not a physical noise source, but its output cannot be predicted or reproduced, which is the standard required for passwords and encryption keys.
What is the formula for a random number in a range?
Given a random value u between 0 and 1, a whole number from min to max is min + floor(u × (max − min + 1)). This tool instead draws random 32-bit integers and rejects the few that would make some results more likely, so every number in the range is exactly equally likely.
How do I generate random numbers in Excel or Google Sheets?
Use =RANDBETWEEN(1, 100) for a whole number from 1 to 100, or =RAND() for a decimal between 0 and 1. Both recalculate every time the sheet changes, so copy and paste them as values if you need to keep a draw.
Can I use this for a raffle or giveaway?
Yes. Number the entries from 1 to the total, set the range to match, choose how many winners you need and leave repeats off. Note the settings and the time of the draw, or record your screen, so participants can see it was fair.
What are the chances of getting the same number twice?
Higher than most people expect. Drawing 10 numbers from 1 to 100 with repeats allowed gives a 37.18% chance that at least two match. This is the same effect as the birthday problem.
How many ways are there to choose 6 numbers from 49?
There are 13,983,816 different combinations, so one specific set of 6 numbers from 1 to 49 has a 1 in 13,983,816 chance of being drawn.
How we checked this page: every figure in the examples and FAQs above is produced by this calculator and verified by automated tests against known answers, and the rules and rates come from the sources below. Last updated . Spotted a problem? Tell us.
Sources and further reading