Last updated: May 2026
Generate random integers or decimals within any range, produce a list of unique random numbers, roll dice, or flip a coin.
A random number generator (RNG) produces numbers with no predictable pattern. In computer science, true randomness is surprisingly hard to achieve — computers are deterministic machines that follow exact instructions. What most software uses instead is a pseudo-random number generator (PRNG), an algorithm that produces a long sequence of numbers that statistically behave like random outputs. Common algorithms include the Mersenne Twister (used in Python and many other languages) and xorshift. These algorithms start from a "seed" value and deterministically generate their sequence — given the same seed, you get the same sequence every time.
For most everyday uses — picking raffle winners, generating quiz questions, rolling dice in tabletop games, or creating test data — a PRNG is more than sufficient. Cryptographic applications (passwords, encryption keys) require a cryptographically secure PRNG (CSPRNG), which uses additional entropy sources like hardware timing, mouse movements, or OS-level random noise pools. Browser-based generators, including this one, use JavaScript's Math.random() or the Web Crypto API's crypto.getRandomValues() for stronger randomness. For dice rolls and casual picks, either approach is perfectly fair.
| Die | Sides | Common Use | Probability of Any Result |
|---|---|---|---|
| d4 | 4 | Damage (daggers, magic missiles) | 25.00% (1 in 4) |
| d6 | 6 | Damage, Yahtzee, board games | 16.67% (1 in 6) |
| d8 | 8 | Damage (longsword, healing potions) | 12.50% (1 in 8) |
| d10 | 10 | Damage, percentile rolls | 10.00% (1 in 10) |
| d12 | 12 | Damage (greataxe), hour rolls | 8.33% (1 in 12) |
| d20 | 20 | Attack rolls, saving throws (D&D) | 5.00% (1 in 20) |
| d100 | 100 | Percentile skill checks, loot tables | 1.00% (1 in 100) |
Is a computer-generated random number truly random?
Most computer random numbers are pseudo-random, not truly random. They are generated by a deterministic algorithm seeded with an initial value. The output is statistically indistinguishable from true randomness for most purposes, but it is technically reproducible if you know the seed and algorithm. Truly random numbers require a physical entropy source such as radioactive decay, thermal noise, or hardware timing jitter.
What is a PRNG?
PRNG stands for Pseudo-Random Number Generator. It is an algorithm that uses a starting value (the seed) to produce a long, complex sequence of numbers that passes statistical tests for randomness. The Mersenne Twister, used in Python's random module, has a period of 2^19937 − 1, meaning it won't repeat its sequence for an astronomically long time. For non-cryptographic applications, PRNGs are universally considered acceptable.
What is the difference between random and pseudo-random?
True randomness is unpredictable and non-reproducible — even with perfect knowledge of the system. Pseudo-randomness is deterministic: given the same seed, the same sequence is produced every time. In practice, the distinction matters primarily for cryptography and security. For games, simulations, sampling, and general tools, pseudo-random generators are considered equivalent to truly random.
How are dice probabilities calculated?
For a fair die with N sides, each face has an equal probability of 1/N. The probability of rolling a specific value is 1/N; the probability of rolling within a range is (number of values in range)/N. For multiple dice, multiply probabilities for independent events or sum probabilities for mutually exclusive outcomes. Rolling 2d6 and getting a 7, for example, has 6 favorable outcomes out of 36 total = 16.67% probability.
What does "seed" mean in random number generation?
A seed is the initial input value fed into a PRNG algorithm. Since the algorithm is deterministic, the same seed always produces the same sequence of "random" numbers. This is intentional and useful: game developers use fixed seeds to create reproducible procedural worlds (Minecraft's world seeds work this way), and scientists seed their simulations so experiments can be replicated exactly. When you want different results each time, the seed is typically set to the current timestamp or OS entropy.