Random Number Generator
Generate one or more random numbers within any range.
True random vs. pseudo-random numbers
Computers are deterministic machines β they cannot generate truly random numbers without an external source of entropy. Most software uses pseudo-random number generators (PRNGs): algorithms that produce sequences of numbers that appear random but are determined by an initial seed value. For most applications (simulations, games, statistical sampling), PRNGs are perfectly adequate. For cryptographic purposes (key generation, session tokens), you need a cryptographically secure PRNG (CSPRNG) that draws entropy from hardware noise, mouse movements, or other unpredictable sources.
Applications by type of randomness needed
| Use case | Type needed | Why |
|---|---|---|
| Games & simulations | PRNG (standard) | Speed matters; predictability is acceptable |
| Statistical sampling | PRNG (standard) | Large volume; reproducible seeds are often desired |
| Dice rolls / lotteries | CSPRNG | Unpredictability is required for fairness |
| Password generation | CSPRNG | Must be impossible to predict even with algorithm knowledge |
| Session tokens | CSPRNG | Predictable tokens would allow account hijacking |
| Encryption keys | CSPRNG | Security of the entire system depends on key unpredictability |
| OTP codes | CSPRNG | Time-based; must be unguessable between intervals |
The gambler's fallacy with random numbers
Past random numbers have no influence on future ones. If a dice shows 6 five times in a row, the probability of 6 on the next roll is still exactly 1/6. This misunderstanding β believing that outcomes "balance out" β is the gambler's fallacy. Each random draw is independent. When generating multiple random numbers in a range, you can and will get repeats, and that is mathematically correct behaviour.
Frequently asked questions
How random are the numbers?
They are generated using your browser's built-in random number generator, which is suitable for everyday uses like draws, games and sampling.
Can I set a minimum and maximum?
Yes. Enter any range and the tool returns a number within those bounds, inclusive of both ends.
Can it generate unique numbers without repeats?
For draws where repeats are not wanted, generate within your range and discard duplicates, or use the option to produce a set of distinct values if available.
Is this suitable for cryptographic use?
For lotteries, security keys or anything high-stakes, use a cryptographically secure generator. This tool is intended for general, non-critical randomness.
result = min + Math.random() Γ (max β min), rounded to chosen decimal places.