Skip to main content
Utulio
Utility Tools

Random Number Generator

Generate random numbers within any range using cryptographic randomness. Supports bulk generation up to 10,000 numbers, no-duplicates mode, and sorted output.

Uses crypto.getRandomValues() with rejection sampling for unbiased results.

Cryptographic vs. Pseudo-Random Numbers

Most programming languages provide a "random" function based on a deterministic algorithm (PRNG — pseudo-random number generator). These produce numbers that look random but are actually predictable if you know the seed. For games, simulations, and non-security uses, PRNGs are fine.

For anything requiring fairness (raffles, cryptography, security), use a CSPRNG (cryptographically secure PRNG). This generator uses crypto.getRandomValues(), which draws from hardware entropy sources — the results are genuinely unpredictable and not reproducible.

Rejection sampling technique used here: const range = max - min + 1; const maxValid = Math.floor(0xFFFFFFFF / range) * range; — discard values ≥ maxValid to eliminate modular bias, then compute min + (rand % range).

Random Number Generator FAQs

Is this random number generator truly random?
This generator uses crypto.getRandomValues() — the browser's cryptographically secure random number generator (CSPRNG). Unlike Math.random(), which is a pseudo-random algorithm, CSPRNG uses hardware entropy sources to generate unpredictable random numbers. Rejection sampling ensures perfectly uniform distribution with no bias toward any particular number.
What is rejection sampling?
Rejection sampling eliminates modular bias. If you generate a random 32-bit number (0–4,294,967,295) and take it modulo 100, numbers 0–95 appear slightly more often than 96–99 because the range doesn't divide evenly. Rejection sampling discards numbers that would cause this bias, ensuring exactly equal probability for every number in your range.
What does "no duplicates" mean?
When you disable duplicates, each generated number appears at most once in the result set. This is equivalent to randomly drawing numbers from a pool without replacement. For example, generating 5 unique numbers in range 1–10 gives 5 different numbers, none repeated. The total count cannot exceed the size of the range.
How do I pick a random winner from a numbered list?
Set min to 1, max to the number of entries, and count to 1. Generate once to get the winning number, then look up that position in your list. For multiple winners, increase the count and enable "no duplicates" to ensure each position is picked at most once.
Can I generate random lottery numbers?
Yes — for example, Powerball uses 5 numbers from 1–69 (no duplicates). Set min=1, max=69, count=5, no duplicates enabled, sorted. For the Powerball number itself (1–26), run a separate generation. Note: this generator is for fun and practice — actual lottery drawings use certified random number generators with regulatory oversight.
What is the maximum number of numbers I can generate?
This generator supports up to 10,000 numbers per generation. For no-duplicates mode, the count must not exceed the range size (max − min + 1). The display shows the numbers as chips; for very large sets, use the "Copy All" button to copy the full list.

Related Tools