Free Random Number Generator

Set a minimum and maximum, choose how many numbers you need, and decide whether duplicates are allowed. Every number is drawn with cryptographic randomness, right in your browser.

This free random number generator draws integers from any range you set, using the browser's cryptographic random number source instead of the weaker Math.random. You can generate up to 10,000 numbers at once and choose whether duplicates are allowed, which makes it work for raffles, classroom pickers, dice rolls, and sampling.

For games, raffles, classrooms, and sampling. Not certified for regulated gambling or cryptographic key generation; those need audited hardware randomness.

Embed this free calculator

Paste this code on your site. Please keep the attribution link.

How random numbers work

Computers cannot roll dice, so they use algorithms to produce randomness. The common Math.random in browsers is a pseudorandom generator: fast and fine for games, but its output can be predicted if you know its internal state. This tool uses crypto.getRandomValues instead, which draws from the operating system's entropy pool, the same source browsers use for security features.

Turning random bits into a fair number in your range takes care. The naive approach, taking random bits modulo the range size, slightly favors low numbers when the range does not divide the bit space evenly. This is called modulo bias. This generator avoids it with rejection sampling: it draws a random value and throws away any draw that falls in the biased leftover zone, then draws again.

When duplicates are off, the tool keeps a set of already-picked numbers and redraws any repeat. That is why the count cannot exceed the size of the range with duplicates off: there are only so many unique numbers to give. With duplicates on, each draw is independent, so repeats are expected, just like rolling a die twice can show the same face.

True randomness versus pseudorandomness rarely matters for picking a raffle winner, but it matters for security. Passwords, tokens, and encryption keys need the cryptographic source. This tool uses the cryptographic source for everything, so your classroom picker and your dice roller both get the strong version.

Randomness also has a memory myth worth dropping: after ten coin flips land heads, tails is not 'due.' Each draw is independent. A good generator has no memory, no streaks to break, and no obligation to feel fair in the short run.

Random number questions

Are the numbers truly random?

They come from crypto.getRandomValues, the browser's cryptographic randomness source, which draws from the operating system's entropy pool. The tool also uses rejection sampling to remove modulo bias, so every number in your range has an equal chance. That is strong enough for raffles, games, classrooms, and statistical sampling.

Why does it say the count is too large with duplicates off?

With duplicates excluded, the tool can only hand out each number once, so the count cannot exceed the number of integers in the range. A range of 1 to 10 holds 10 unique numbers. Either allow duplicates or widen the range.

Can I use this to pick a raffle winner?

Yes. Set the minimum and maximum to your ticket range, for example 1 to 500, set the count to 1, and draw. Every ticket has an equal chance on every draw because each draw is independent and unbiased.

What is the difference between this and Math.random?

Math.random is a fast pseudorandom generator: deterministic under the hood, and its future output can be predicted if the internal state leaks. crypto.getRandomValues draws from the operating system's entropy pool and is unpredictable. For games it rarely matters; for anything fairness-related, the cryptographic source is the right call.