Random Integer Generator
Generate one random integer between any two values. Click Generate to get a new number instantly.
Multi-Number Generator
Generate multiple integers or decimals. Control duplicates, sort order, and decimal precision.
Coin Flip
Flip one or more virtual coins at once.
Dice Roller
Roll standard or custom-sided dice.
Random Item Picker
Pick random items from your custom list. One item per line.
Random Date Generator
Generate a random date between any two calendar dates.
What Is a Random Number?
A random number is a value drawn from a set of possible values such that each value is equally likely to be selected and no pattern or rule can predict which value comes next. True randomness requires a physical source of unpredictability - thermal noise, radioactive decay, atmospheric turbulence, or other quantum phenomena.
In computing, most random number generation uses algorithms rather than physical sources. These produce pseudo-random number sequences: deterministic outputs that pass statistical tests for randomness but are fully reproducible from a starting value called a seed. Given the same seed, a pseudo-random generator always produces the same sequence. JavaScript's Math.random() function - used by this calculator - is a pseudo-random generator, as are the RNG functions in virtually every programming language.
When Pseudo-Random Is Enough
For most practical purposes - simulations, games, sampling, lotteries, shuffling, and statistical experiments - pseudo-random numbers work well. The sequences are unpredictable in practice because the seed is drawn from the system clock or similar sources that change continuously.
For cryptographic applications such as generating encryption keys, authentication tokens, or passwords, standard pseudo-random generators are not sufficient. Use a cryptographically secure PRNG, such as the Web Crypto API (window.crypto.getRandomValues()), which sources entropy from hardware events and is designed to resist prediction even by an attacker who knows the algorithm.
How Random Integers Are Generated
Generating a random integer in the range [min, max] (inclusive on both ends) from a uniform [0,1) random float uses this formula:
The +1 in the range calculation ensures the maximum value is reachable. Without it, you would get integers from min to max-1.
Generating Without Duplicates
When duplicates are not allowed and you need to draw multiple unique values, the correct method is a partial Fisher-Yates shuffle of the full range:
- Create the complete list of integers from min to max.
- For each position i from 0 to count-1, swap element i with a randomly chosen element from position i to the end of the list.
- Take the first count elements.
This is mathematically equivalent to drawing numbered balls from a bag without replacement. Each remaining value is equally likely at each step. This calculator uses this method when the no-duplicates option is selected.
Uses of Random Number Generators
| Application | Type Used | Notes |
|---|---|---|
| Lottery and prize draws | Integer, no duplicates | Pick N winners from a pool of entries without picking the same person twice |
| Statistical sampling | Integer, no duplicates | Select a random sample of individuals from a numbered population |
| Monte Carlo simulations | Decimal, many values | Simulate physical processes by sampling random inputs millions of times |
| Games and tabletop RPG | Dice roller, integers | Replace physical dice; generate random dungeon maps, loot tables, or events |
| A/B testing | Integer or decimal | Randomly assign users to treatment and control groups |
| Shuffling playlists | Fisher-Yates shuffle | Random item picker with all items and no repeats produces a full shuffle |
| Random team assignment | Random item picker | Shuffle a list of names and group the output by position |
| Cryptographic keys | CSPRNG only | Standard PRNGs are not safe for this purpose; use Web Crypto API |
| Quiz randomization | Integer, no duplicates | Pick question numbers from a bank without repeating |
| Random date generation | Date generator | Test databases, generate fictional event timelines, or pick a random deadline |
Uniform vs Non-Uniform Distributions
All generators on this page produce uniformly distributed numbers: every value in the range is equally likely. Many real-world phenomena follow other distributions.
Normal (Gaussian) Distribution
Heights, test scores, and measurement errors tend to cluster around a mean with fewer values far from the centre. Generating normal random numbers from a uniform source uses the Box-Muller transform: given two uniform random numbers U1 and U2, generate Z = sqrt(-2 ln U1) ร cos(2ฯ U2). The result Z follows a standard normal distribution (mean 0, standard deviation 1). Scale and shift to get any mean and standard deviation.
Exponential Distribution
Time between independent events (server requests, bus arrivals, radioactive decay) often follows an exponential distribution. Generate from a uniform U using: X = -ln(U) / ฮป, where ฮป is the rate parameter.
Why Uniformity Matters Here
For random draws, lottery picks, sampling, and shuffles, uniform distribution is exactly what you want - no value is favoured. If you are modelling a process where some outcomes are more likely than others, apply a transformation to the uniform output to match your target distribution.