Translation unavailable - this article is shown in English. View English version
Summary
A random number generator (RNG) produces numbers that cannot be predicted better than by chance. In computing, most RNGs are pseudorandom — they use deterministic algorithms seeded with an initial value to produce sequences that appear random but are reproducible. True random number generators derive entropy from physical processes (thermal noise, radioactive decay). This calculator generates random integers within a specified range using a uniform distribution, where every value in the range is equally likely.
How it works
The calculator supports several modes:
- Single random number — generates one integer between a minimum and maximum value (inclusive), drawn from a discrete uniform distribution.
- Multiple random numbers — generates a set of random integers. Values may repeat (sampling with replacement) unless uniqueness is specified.
- No repeats (permutation) — draws values without replacement. The number of possible orderings of k items chosen from n is given by the permutation formula.
Pseudorandom vs true random
Browsers use crypto.getRandomValues(), a cryptographically secure pseudorandom number generator (CSPRNG) that meets NIST SP 800-90A standards. This is suitable for games, simulations, and general-purpose randomization. For cryptographic key generation or gambling regulation, hardware-based true RNGs are required.
The formulas
Where
Where
Worked examples
Probability of rolling a specific number on a die
Identify the range
= 6 possible outcomes
Apply uniform distribution formula
= 0.1667 (16.67%)
Result
Each face has a 1 in 6 (16.67%) chance
How many ways to draw 3 unique numbers from 1-10?
Identify n and k
= n = 10, k = 3
Apply permutation formula
= 720
Result
There are 720 possible ordered selections of 3 unique numbers from 1 to 10
Practical uses
- Games and lotteries — dice rolls, card shuffles, raffle drawings, and lottery number selection all rely on uniform random generation.
- Statistical sampling — researchers randomly select participants from a population to avoid selection bias.
- Simulations — Monte Carlo methods use random numbers to model complex systems in finance, physics, and engineering.
- Randomized algorithms — many computer science algorithms (quicksort pivot selection, hash functions) use randomness for efficiency.
Assumptions & limitations
- Pseudorandom, not truly random — browser-generated numbers are computationally unpredictable but ultimately deterministic. For most purposes this is sufficient.
- Integer range — this calculator generates integers only. For continuous random values, the result can be divided by a power of 10.
- No-repeat constraint — when generating unique values, the count requested cannot exceed the range size. Requesting 20 unique numbers from 1-10 is impossible.
- Uniform only — this calculator produces a uniform distribution. Other distributions (normal, exponential) require transformation methods.