Free Random Number Generator: Cryptographically Strong, Unbiased
Generate one or thousands of random integers in any range. Uses the browser's Web Crypto API with rejection sampling to eliminate modulo bias — suitable for raffles, sample selection, and tabletop dice. 100% client-side.
Cryptographic Strength
Uses `crypto.getRandomValues` — the browser's Web Crypto API — not `Math.random()`. Suitable for raffles, security tokens, and statistical sampling.
No Modulo Bias
Naive `bytes % range` skews the distribution on non-power-of-two ranges. We use rejection sampling against a 32-bit limit so every value in the range is equally likely.
Up to 10,000 Numbers
Generate a single value or a list of 10,000. Optional uniqueness constraint (no repeats), optional ascending sort, and one-click copy of the full list.
100% Client-Side
Random bytes are sourced from your local browser. Raffle picks, lottery numbers, and sampling results never leave your device — provably fair, provably private.
The Random Number Generator That Respects the Math
Most online random number generators have two problems: they use JavaScript's Math.random() (a predictable 32-bit PRNG, not cryptographically strong) and they apply naive % range math that introduces modulo bias. The result is a tool you cannot trust for raffles, lottery picks, statistical sampling, or anything else that matters. Our Free Online Random Number Generator uses the browser's Web Crypto API (the same CSPRNG that secures your HTTPS connections) combined with rejection sampling for a provably uniform distribution over any range.
Pair this generator with our UUID Generator (when you need globally unique IDs rather than numeric ranges), the Password Generator (for cryptographic-string output), the Hash Generator (for deterministic derivation from a seed), and the Password Strength Meter (to verify the entropy of any generated secret).
Math.random() vs crypto.getRandomValues()
| Property | Math.random() | crypto.getRandomValues() |
|---|---|---|
| Source | Software PRNG (Xorshift+ / Mulberry) | OS entropy pool (hardware-backed) |
| Output bits | 32 bits per call | Arbitrary (typically 32-bit `Uint32Array`) |
| Predictable? | Yes — after ~5 outputs | No — cryptographically strong |
| NIST SP 800-90A compliant? | No | Yes (when OS source qualifies) |
| Safe for security tokens? | No | Yes |
The Modulo-Bias Problem (Why It Matters)
Suppose you want a uniform random integer in [0, 99]. Naive code:
const n = crypto.getRandomValues(new Uint32Array(1))[0]; const result = n % 100; // ❌ biased
2³² = 4,294,967,296. Divided by 100 gives 42,949,672 with a remainder of 96. Values 0 through 95 each map back from 42,949,673 raw inputs, while values 96 through 99 each map back from only 42,949,672 raw inputs. The bias is tiny (one part in 42 million) but real — and it compounds dramatically for smaller ranges. For a 1-in-7 random draw, the bias can reach 0.04%, enough to fail a chi-squared test on a large sample. Our tool fixes this with rejection sampling:
const range = 100;
const limit = (2 ** 32) - ((2 ** 32) % range);
let n;
do {
n = crypto.getRandomValues(new Uint32Array(1))[0];
} while (n >= limit); // ✓ uniform
const result = n % range;Six Real Uses for an Unbiased Random Number Generator
1. Raffles & Drawings
Assign a number to each entrant, generate a unique random pick from the range. Provably fair for small-stakes drawings; cryptographically strong source.
2. Statistical Sampling
Pick 100 unique row IDs from a database of 10,000. Use “unique” mode and copy the list into your SQL `WHERE id IN (...)` clause.
3. Test Data Generation
Generate 1,000 random integers in [0, 9999] to seed test fixtures, randomise A/B-test bucketing, or stress-test data-validation logic.
4. Tabletop RPG Dice
D6, D8, D10, D12, D20 — preset chips give you any standard die. No physical dice required, no dice-tower-flailing during online sessions.
5. Lottery Number Picking
Powerball 5/69, EuroMillions 5/50, UK Lottery 6/59 — one-click presets generate unique sorted picks for any major lottery.
6. Tie-Breaking
Order ambiguous? Generate one random integer in [1, N] to choose between N tied options. Use sorted ascending output as a permanent serial-decision record.