Random Number Generator – Generate Random Numbers
Generate random integers within any range. Supports multiple numbers at once.
About This Calculator
Generate random integers within any range. Supports multiple numbers at once. Use the calculator above for instant results.
Random Integers, Ranges, and Independence
A uniform random-integer generator aims to give every integer in the chosen inclusive range the same probability on each draw. If the minimum is m and the maximum is M, the number of possible integer outcomes is M − m + 1. Each outcome should therefore have probability 1/(M − m + 1) when the generator is uniform.
For a range from 1 through 6, there are six possible outcomes, so each has probability 1/6. Generating several values with replacement means a previous result does not remove that value from future draws. Repeats are therefore expected. If a task requires sampling without replacement, such as selecting distinct students or shuffling a deck, the algorithm must track which items have already been selected.
Most browser-based generators are pseudorandom rather than physically random. A pseudorandom number generator starts from an internal state and produces a sequence that is designed to behave statistically like random data. This is suitable for demonstrations, simulations, games, and ordinary sampling, but security-sensitive uses such as cryptographic keys require a cryptographically secure source rather than a general-purpose pseudorandom function.
Randomness does not mean a short sequence must look evenly distributed. Ten fair die rolls can contain repeated sixes or omit a face entirely. Uniformity is a long-run property of the generating process, not a promise that every small sample contains equal counts.
Worked Examples
- e.g. 42 (random each time!)
Answer: Random 1-100
- e.g. 4 and 2 — dice simulator
Answer: Dice simulator
- Random card index
Answer: Card draw
The possible outcomes are 10, 11, 12, 13, 14, and 15.
- Number of outcomes = 15 − 10 + 1 = 6
Answer: each integer has probability 1/6 ≈ 16.67%
The +1 is required because both endpoints are included.
Generate three values from 1 through 6 with replacement.
- A sequence such as 4, 4, 2 is valid.
Answer: repeats are allowed
Repeated values do not indicate a malfunction when draws are independent and made with replacement.
Who Uses This Calculator?
Dice rolls and random events.
Random sampling.
Random student selection.
Quick random number.
Common Mistakes to Avoid
❌ Not truly random
Math.random() is pseudorandom. For cryptography use crypto.getRandomValues().
❌ Range is inclusive
Min and max are both included in possible outputs.
❌ Assuming random means no repeats
Independent draws with replacement can repeat. To guarantee distinct values, use a sampling-without-replacement or shuffle procedure instead.
❌ Using ordinary pseudorandom output for secrets
General-purpose browser pseudorandom functions are not a substitute for cryptographically secure randomness when generating passwords, keys, tokens, or security-critical values.
Repeated draws can contain duplicates unless a without-replacement sampling method is explicitly requested.
Frequently Asked Questions
True vs pseudorandom?
True random: from physical sources. Pseudo: deterministic algorithm. Sufficient for most purposes.
Dice probability?
Fair die: each face 1/6 = 16.7%. Two dice: 7 is most likely sum (6/36).
How to shuffle?
Assign random number to each item, sort by it. Known as Fisher-Yates shuffle.
Is the maximum value included in an integer range?
For an inclusive integer range, yes. A range from 3 through 7 contains five outcomes: 3, 4, 5, 6, and 7. The outcome count is max − min + 1.
What does sampling with replacement mean?
After each draw, the selected outcome remains available for the next draw. The probabilities stay the same from trial to trial and repeated values are possible. Without replacement, the available set changes after each selection.
Can a fair random generator produce a long streak?
Yes. Streaks are unlikely but possible. Randomness does not forbid patterns; it assigns probabilities to them. Judging fairness from a very small sample can therefore be misleading.
What is a seed in pseudorandom generation?
A seed initializes the internal state of a deterministic pseudorandom algorithm. In generators that expose seeds, using the same seed and algorithm reproduces the same sequence, which is useful for repeatable simulations and tests.
Formula Explorer connections
Interpretation: This relationship converts, summarizes or checks numerical quantities using standard arithmetic and measurement rules. Assumption: Use consistent units, preserve enough significant digits, and round only the final result unless the method states otherwise.