How does a random number generator work?
Computers can produce two kinds of random numbers. Pseudo-random generators follow a formula and can be predicted if you know the starting value. This tool uses crypto.getRandomValues, the secure source built into browsers, which draws on unpredictable data from your device. To pick a whole number between min and max, it takes a random value and maps it to the range without favouring any number.
Picking 1 to 100 gives each number a 1% chance.
With and without repeats
With repeats allowed, each pick is independent, so the same number can appear twice, like rolling a die twice. Without repeats, numbers are drawn like names from a hat. You can only ask for as many unique numbers as there are values in the range: 10 unique whole numbers from 1 to 5 is impossible.
| Use | Setting |
|---|---|
| Raffle winners | 1 to the number of tickets, unique |
| Lottery-style pick | For example 1 to 49, 6 numbers, unique, sorted |
| Random sample | Row numbers, unique |
| Simulations | Decimals, repeats allowed |
Common uses and limits
- Choosing winners, teams or the order of presentations.
- Games, quizzes and classroom activities.
- Sampling data for testing and statistics.
Random numbers are not a way to beat a lottery: every combination is equally likely. Do not use this page to generate secrets such as passwords; use the password generator instead. For dice, see the dice roller, and for averages of your results, the mean, median and mode calculator.
Complete guide to the Random Number Generator
How to use the Random Number Generator, step by step
- Set the minimum and maximum.
- Choose how many numbers and decimal places.
- Tick unique or sorted if needed.
- Generate and copy.
Common mistakes to avoid
- Asking for more unique numbers than fit.
- Expecting random numbers to look evenly spread.
- Using random numbers as secrets.
Key terms explained
- Range
- The numbers between a minimum and maximum.
- Unique
- No number appears twice.
- Pseudo-random
- Produced by a formula.
- Seed
- The starting value of a generator.
Want the full walkthrough? Read our guide: How Random Number Generators Work (True vs Pseudo-Random).
Frequently asked questions
Are the numbers truly random?
They come from your browser’s secure random source, which is suitable for games, draws and sampling.
How do I pick a random number between 1 and 10?
Set the minimum to 1, the maximum to 10 and the count to 1, then press generate.
Can I get numbers without repeats?
Yes. Tick "No repeats". You cannot ask for more unique numbers than the range holds.
Can I generate decimals?
Yes. Choose the number of decimal places, and the numbers will be between your minimum and maximum.
Is it fair for a raffle?
Yes, each ticket has the same chance, but for official draws, follow your local rules.