🎲 Random Number Generator
Pick random numbers in any range: one or thousands at once, with or without repeats, sorted or in draw order. Uses your browser’s cryptographic randomness.
Set a range and press Generate.
What Random Number Generator Does
This random number generator draws whole numbers or decimals from any range you set — one at a time or up to 10,000 in a single click — with or without repeats. Every value comes from crypto.getRandomValues, the cryptographically secure generator that browsers provide for things like encryption keys, rather than the faster but predictable Math.random.
The part most generators get subtly wrong is turning raw random bits into a number in your range. The shortcut, taking the remainder after division, makes some results more likely than others whenever the range does not divide the raw range evenly. This tool uses rejection sampling instead: raw values that would cause that imbalance are thrown away and drawn again, so every number in the range has exactly the same chance.
With No repeats ticked, numbers are drawn without replacement, the way slips come out of a hat. For a draw that covers most of a range, the tool shuffles the whole range with a Fisher–Yates shuffle and takes the first values; for a few numbers from a huge range, it draws until it has enough distinct ones. Both are exact.
How to Use Random Number Generator
- Enter a minimum and maximum, or tap a preset range
- Choose how many numbers you want and how many decimal places
- Tick No repeats if each number may appear only once
- Pick a sort order and press Generate
- Copy the result or generate again — recent results are listed below
Formula Used by Random Number Generator
Why the remainder shortcut is biased (modulo bias)
value = (random byte mod 100) + 1 ← uneven when 256 is not a multiple of 100
- random byte
- An integer from 0 to 255 — 256 equally likely values
- mod 100
- The remainder after dividing by 100, giving 0–99
Worked example
Mapping one random byte to a number from 1 to 100 with the remainder.
- 256 = 2 × 100 + 56, so remainders 0–55 can each be reached three ways (e.g. 5, 105, 205)
- Remainders 56–99 can only be reached two ways (e.g. 60, 160)
- So 1–56 each come up with probability 3/256; 57–100 each with 2/256
Result: Numbers 1–56 are 50% more likely than 57–100. Rejection sampling discards bytes 200–255 and redraws, leaving exactly 2/200 for every value.
Chance of at least one repeat when repeats are allowed
P(repeat) = 1 − (n × (n−1) × … × (n−k+1)) ÷ nᵏ
- n
- How many different values the range contains
- k
- How many numbers you draw
Worked example
Drawing k = 10 numbers from 1–100 with repeats allowed.
- Probability all ten differ = (100 × 99 × … × 91) ÷ 100¹⁰ ≈ 0.628
- Probability of at least one repeat = 1 − 0.628
Result: About a 37% chance of a duplicate — which is why “No repeats” exists.
How Soon Repeats Appear
Chance that a list drawn with repeats allowed contains at least one duplicate. Calculated with the formula above.
| Range | Numbers drawn | Chance of a repeat |
|---|---|---|
| 1–6 | 3 | 44.4% |
| 1–10 | 4 | 49.6% |
| 1–100 | 10 | 37.2% |
| 1–100 | 12 | 49.7% |
| 1–365 | 23 | 50.7% |
| 1–1,000 | 38 | 50.9% |
How to Read Your Result
Streaks and clusters are normal
Random output often looks less random than people expect: the same number twice in a row, three low numbers together, a long gap before a value appears. Evenly spread results over a short run would actually be suspicious. Judge randomness over hundreds of draws, not a handful.
Pseudo-random is not a weakness here
Browsers generate these values with a cryptographic pseudo-random generator seeded from operating-system entropy — the same design approach NIST describes for deterministic random bit generators. For classroom picks, sampling, games and simulations it is indistinguishable from physical randomness and cannot be predicted from earlier output.
Limitations & Accuracy Notes
- Results are not saved anywhere; if you need an auditable public draw, record the result yourself or use a service that publishes signed results.
- Decimal mode draws from a grid (for example 0.00, 0.01 … 1.00 at two places), not from every real number in the range.
- Ranges wider than 2⁵³ values cannot be sampled exactly with standard JavaScript numbers and are refused rather than approximated.
- Up to 10,000 numbers per click; very large no-repeat draws over huge ranges take longer because each value must be checked for duplicates.
Frequently Asked Questions
How random are these numbers?
How do I generate numbers with no repeats?
Why did I get the same number twice in a row?
Can it generate decimal numbers?
Is this a true random number generator?
How many numbers can I generate at once?
How do I pick a random number between 1 and 100?
References & Further Reading
- MDN Web Docs — Crypto.getRandomValues() — The browser’s cryptographically strong random source
- NIST SP 800-90A Rev. 1 — Random Number Generation Using Deterministic Random Bit Generators — How cryptographic pseudo-random generators are specified