Random Number Generator
Generate one or more random numbers between a minimum and maximum value. Choose between integer or decimal results. Great for games, decision-making, or testing.
Random number generators (RNGs) are foundational tools across computer science, gaming, statistics, simulation, security, and many other fields. Two main types: pseudorandom (PRNG — algorithm-based, deterministic given seed but unpredictable in practice for non-cryptographic uses) and true random (TRNG — derived from physical noise sources like atmospheric noise, radioactive decay, or quantum phenomena). For most everyday uses — picking random items, generating game elements, fair drawings, testing — pseudorandom is sufficient and indistinguishable from true random. For cryptography, secure password generation, and serious lottery applications, true random sources are required.
This calculator generates random integers or decimals within a specified range. Use it for: random selection (picking from a list by assigning numbers), game elements (random encounters, item drops, character generation), fair drawings (door prizes, random sampling), testing applications (random input generation), probability demonstrations, or any need for unbiased random values. Common applications: choosing daily lottery numbers, picking a random task to start, simulating market scenarios for finance modeling, generating random test data, breaking ties or making random selections.
Important context: this calculator uses JavaScript's Math.random() PRNG, which is fast and produces statistically uniform results suitable for non-cryptographic uses. Each number generated is independent — no number is "due" or "less likely" because of previous results (gambler's fallacy). For true randomness in security-critical applications, use specialized sources (random.org for atmospheric noise; quantum random number generators for highest security). For most decision-making, gaming, and testing purposes, this calculator works equivalently to physical methods (drawing slips of paper, rolling many dice) but instantly and reproducibly.
Inputs
0 for whole numbers
Change this value to get new numbers
Results
Result
4
Sum
4.00
Average
4.00
Formula
How to use this calculator
- Enter minimum value (lowest possible result).
- Enter maximum value (highest possible result).
- Enter count of numbers to generate (1-20).
- Enter decimal places (0 for integers; 1-6 for decimals).
- Change "Reshuffle" value to generate new numbers.
- For random selection: assign numbers to your list items, generate one random number, pick corresponding item.
- For lottery picks: generate as many unique numbers as needed (note: this calculator can generate duplicates; manually verify uniqueness or use specialized lottery picker).
- For unbiased decisions: assign options to ranges (1-50 = Option A, 51-100 = Option B), generate 1-100, decide.
- For testing applications: generate random values to test edge cases, performance under random load.
- For probability demonstration: generate many numbers, observe approximate uniformity.
- For weighted selection: increase range for more-likely outcomes. Item A gets 1-70 (70% likely), Item B gets 71-100 (30% likely).
- For cryptography or security: do NOT use this calculator. Use cryptographic random sources (random.org, crypto.getRandomValues()).
Worked examples
Random task selection
Choose a task from 5-item list: 1. Finish report 2. Clean office 3. Reply to emails 4. Plan next week 5. Learn new skill Generate random integer 1-5: result 3. Reply to emails it is. Useful for: paralysis-by-choice scenarios, fairness in task distribution, breaking ties between options, reducing decision fatigue. Pre-commit to following the random result (else why randomize?).
Probability demonstration
Generate 100 random integers between 1-10. Count occurrences of each value. Theoretical: 10 of each value (100/10 = 10). Typical actual results: 1: 8 2: 12 3: 9 4: 11 5: 10 6: 7 7: 13 8: 11 9: 8 10: 11 Each within ~3 of expected 10. Variation is normal. Generate 1000 random integers — closer to 100 of each. Generate 10,000 random integers — closer to 1000 of each. Demonstrates Law of Large Numbers: ratios converge to theoretical with large samples; individual variations expected with smaller samples.
Custom probability event
Game scenario: 15% chance of rare item drop. Generate random 1-100: result 12. 12 ≤ 15 → rare item drops! If result was 35: nothing happens. This pattern (compare random to threshold) is the most common probability implementation in software: 20% chance: random ≤ 20 50% chance: random ≤ 50 Any X% chance: random ≤ X For more complex chances (10% common, 5% uncommon, 1% rare): Random 1-100: 1-90: common item 91-99: uncommon item 100: rare item Cumulative range comparison handles multi-outcome weighted random.
When to use this calculator
Use this calculator for random selection from options, simulation and testing, probability demonstrations, game randomization, fair drawings, lottery number generation (non-cryptographic), or any unbiased random number need.
Pair with dice-roller (specific dice mechanics) and coin-flip (binary random).
Important random number considerations:
1. **Each result is independent.** Past results don't affect future probability. Gambler's fallacy applies — "due" numbers don't exist.
2. **Pseudorandom is sufficient for most uses.** Modern PRNGs produce statistically uniform results. Use true random only for cryptography/security.
3. **Streaks happen.** Even truly random sequences contain runs. 10 random 1-100 might include several similar values clustered together. Not evidence of bias.
4. **For unique numbers (lottery): may need additional logic.** This calculator can generate duplicates. For "pick 6 unique numbers 1-49" use specialized lottery picker or generate and check for uniqueness manually.
5. **Uniformity vs. distribution.** Random 1-100 each number equally likely (uniform). Multi-value sums (like 2d6) produce bell curves. Sum of multiple random produces normal distribution (Central Limit Theorem).
6. **Reproducibility requires seed.** Same seed value reproduces same sequence. Useful for testing, replays, scientific simulations.
7. **Cryptography requires true randomness.** Math.random() NOT suitable for: cryptographic keys, password generation, session tokens, casino-grade randomness. Use crypto.getRandomValues() or random.org for those.
8. **Statistical sampling.** When randomly sampling from a population, ensure: (1) random number range matches population size, (2) selection without replacement if needed, (3) appropriate sample size for statistical confidence.
9. **Use weighting carefully.** For weighted random, ensure weights sum to expected total and ranges don't overlap.
10. **Avoid common selection biases.** "Pick a random number 1-10" tends toward 7 (psychological "random" not statistical). Use calculator for true randomness.
11. **For decisions: pre-commit.** Random doesn't add value if you reroll until desired result. Either trust random or don't randomize.
12. **Distinguish need for fairness vs. optimization.** Fairness scenarios (door prizes, random sampling): use random. Optimization scenarios (best choice, important decisions): use analysis, not random.
Common mistakes to avoid
- Treating random as biased after streaks. Random sequences contain runs naturally.
- Using Math.random() for cryptography. Insecure for any security-critical purpose.
- Forgetting that pseudorandom isn't cryptographically secure. Adequate for games, not for tokens.
- Believing certain numbers are "due." Each generation independent.
- Generating non-unique numbers when uniqueness needed. Specifically lottery-style.
- Using random for decisions deserving analysis. Important choices warrant deliberation, not randomization.
Frequently Asked Questions
Sources & further reading
- Random Number Generation Standards — U.S. National Institute of Standards and Technology
- Random Number Sources — Random.org (atmospheric noise source)
- Statistics and Probability Resources — American Statistical Association