calculatorkong

Random Number Generator

Result

Uniform sampling
rejection sampling on crypto.getRandomValues — every value exactly 1⁄range likely

Random numbers settle raffles, assign homework problems, split teams and seed games — jobs where fairness is the whole point. This generator uses the browser's cryptographic source with rejection sampling, so every number in your range is exactly equally likely.

Why the randomness quality matters

The lazy approach — Math.random() × range — has two flaws: the generator is predictable by design, and the naive mapping gives lower numbers a slightly better chance (modulo bias). For picking a raffle winner, "slightly unfair" is the one property you can't have. crypto.getRandomValues plus rejection sampling eliminates both.

With and without repeats

Default draws are independent — the same number can appear twice, like dice. No-repeats mode draws like lottery balls via a partial Fisher–Yates shuffle: each value appears at most once, which is what team assignments and prize draws usually want. The math guard is automatic: you can't draw 20 distinct numbers from a range of 10, and the tool says so rather than looping forever.

Independence and the "due number" myth

Ten draws without a 7 doesn't make 7 more likely on the eleventh — each draw forgets everything. That intuition (the gambler's fallacy) is worth killing wherever it appears; the history list below the result exists for records, not predictions.

Neighbors in the randomness family

Rolling game dice with modifiers is the dice roller's specialty; random strings for security are the password generator's. All three share the same crypto source and the same promise: generated locally, nothing sent anywhere.

Works offline; no-repeat mode supports ranges up to 1,000,000.

Frequently Asked Questions

How does this generate random numbers? +

With crypto.getRandomValues — the browser’s cryptographic randomness source — plus rejection sampling to make every number in your range exactly equally likely.

Can I generate numbers without repeats? +

Yes — toggle “no repeats” to draw like lottery balls: each number can appear once per draw. The count then cannot exceed the range size, and the calculator says so.

How do I pick a random number between 1 and 100? +

Set min 1, max 100, count 1 and generate. Every integer from 1 to 100 has exactly a 1⁄100 chance.

Is browser randomness good enough for decisions? +

crypto.getRandomValues is cryptographic-quality — suitable for raffles, sampling and games. (True hardware randomness matters only for high-stakes cryptography, and your browser taps OS entropy anyway.)

Why not just use Math.random()? +

Math.random is a fast statistical generator, fine for animations but not designed to be unpredictable and can show modulo bias when mapped carelessly. This page avoids both issues.

Are the same numbers more “due” after not appearing? +

No — each draw is independent. A number absent for ten draws has the same chance on the eleventh. That intuition is the gambler’s fallacy.

Powered by Calculator Kong ↗

Related Calculators