Random Number Generator
Free random number generator. Pick random integers in any range — single number or list of N. Crypto-grade randomness via the Web Crypto API.
Quick answer
Generates cryptographically-random integers in any range using the Web Crypto API's getRandomValues. Values are uniform within the range — no statistical bias toward edges. Single number or list of N; min/max are inclusive.
Random Number Generator
How it works
Generates one or more random integers within a range you specify. Optionally allows duplicates or forces unique values. Uses JavaScript's Math.random for general use (good enough for most non-security contexts).
When to use it
Use this for raffles and giveaways, picking a winner from a list, generating test data, deciding what to eat when you can't pick, randomizing seating charts, or simulating dice rolls and card draws.
Common mistakes
Using Math.random for cryptographic or financial purposes. For anything where randomness needs to be unpredictable (gambling, security tokens, lottery), use the secure code generator above instead — it uses a real CSPRNG.
How the random number generator works
The tool uses crypto.getRandomValues() from the Web Crypto API, which returns cryptographically secure random bytes. To generate an integer in a range, the algorithm draws random bytes and uses rejection sampling — draws that would produce uneven distribution are discarded and re-rolled. This avoids the modulo bias that simpler implementations introduce. The result is uniformly random within the inclusive [min, max] range.
When to use it
Picking a winner from a giveaway list (assign each entry a number, generate a random one). Rolling dice for tabletop games. Generating test data for software development. Creating random sample sets for surveys, A/B testing, or research. Settling tie-breakers fairly. Generating randomized passwords (though the password generator is better for that specific use).
Common mistakes
- Using Math.random for crypto purposes. Math.random is not cryptographically secure — outputs are predictable from previous outputs in some browsers. This tool uses crypto.getRandomValues, which is safe for sensitive applications.
- Confusing inclusive and exclusive bounds. The min and max here are inclusive — random(1, 10) can return 1, 10, or anything in between.
- Treating random as 'evenly distributed' across small samples. 10 random numbers from 1-100 will not produce a tidy spread; clusters and gaps are normal. Statistical evenness only emerges over hundreds or thousands of samples.
Frequently asked questions
How random is the output?
Cryptographically random, via the browser's Web Crypto API. Output is uniform within the chosen range — no statistical bias toward edges, and unpredictable from previous outputs. Suitable for all but specialized cryptographic key generation.
Can I generate multiple random numbers at once?
Yes. Set the count to any value up to 1,000 and the tool generates a list of independent random integers in the chosen range. Useful for assigning numbers to a roster, generating test data, or batch picks.
Are the bounds inclusive or exclusive?
Inclusive on both ends. Random(1, 6) — like a six-sided die — returns 1, 2, 3, 4, 5, or 6, each with equal probability.