“Random” is easy to ask for and surprisingly easy to get wrong. The difference between a generator you can trust for a raffle and one that quietly favors certain numbers comes down to a few ideas: where the randomness comes from, how it is mapped onto your range, and whether you need the draw to be unpredictable or reproducible. This generator is built around those distinctions — cryptographically secure by default, unbiased by construction, with an optional seeded mode for when repeatability matters more than secrecy. The sections below explain what is happening under the hood and how to choose the right settings.
True random vs. pseudo-random
There are two families of randomness. A true (or hardware) random number generator pulls unpredictability from a physical process — electrical noise, timing jitter, radioactive decay. A pseudo-random generator (PRNG) runs a deterministic formula starting from a seed; its output looks random and passes statistical tests, but the whole sequence is fixed once you know the seed.
Your browser bridges the two. crypto.getRandomValues — the source this tool uses by default — is a cryptographically secure PRNG that is continuously reseeded from the operating system’s hardware entropy pool. For practical purposes its output is unpredictable and unbiased, which is why it is the right tool for raffles, security tokens, and anything where someone might benefit from guessing the next value. The older Math.random is a plain PRNG with no security guarantees and is deliberately not used here.
Modulo bias, and why rejection sampling fixes it
This is the mistake most home-grown random code makes. To turn a big random number into, say, a number from 1 to 6, the obvious move is the remainder: 1 + (x mod 6). The problem is that the source has 2³² possible values, and 2³² is not divisible by 6. The leftover values at the top of the range wrap around and land on the first few outcomes, making 1, 2, 3, and 4 very slightly more likely than 5 and 6. With a six-sided die the skew is tiny; with a large range, or over millions of draws, it becomes measurable — and in security contexts it is a real weakness.
The fix is rejection sampling: compute the largest multiple of your range that fits in 2³², draw raw values, and throw away any that land in the leftover bucket before taking the remainder. A few draws are discarded, but every integer in your range ends up exactly equally likely. This generator does that for every integer it produces, so “1–6” really is a fair die and “1–10,000” really is uniform.
Unique vs. repeating, and fair lottery picks
“Allow repeats” draws with replacement: every pick is independent, so the same number can show up more than once — the right model for dice and coin flips. “Unique” draws without replacement: each value appears at most once, which is what you want for a raffle, a team-picker, or a lottery line. When you ask for unique values, the generator shuffles the eligible pool with a partial Fisher–Yates shuffle and takes the first k, which keeps every combination equally likely and guarantees no duplicates.
Two guard rails matter here. You cannot draw more unique values than the range contains — asking for 10 unique numbers from 1–6 is impossible, so the tool draws all it can and warns you. And the exclude list removes specific values (an already-drawn winner, an unlucky 13) from the pool before the draw, which also shrinks the unique pool.
When to use a seed (reproducibility)
Most of the time you want randomness you cannot predict, so the default crypto-secure mode is correct. But sometimes you want the opposite: a draw you can repeat on demand. That is what the seed is for. In Seeded mode the numbers come from mulberry32, a deterministic PRNG, and the same seed with the same settings always produces the same numbers.
This is genuinely useful. A researcher can publish the seed alongside a study so the random sample is reproducible. A raffle host can announce the seed in advance so participants can verify the draw afterward instead of trusting it. A developer can seed test data so failing tests are repeatable. The trade-off is that a seeded sequence is, by design, predictable to anyone who knows the seed — so never use seeded mode to generate passwords, keys, or anything that must stay secret.
Is it fair? Reading the distribution
“Is this actually random?” is a fair question, and the Statistics tab is there to answer it. For a single small draw you cannot tell much — five numbers from 1–100 will not look evenly spaced, and that is normal; true randomness is lumpy, not tidy. The pattern only emerges at scale. Roll a die a few hundred times, or generate a large sample, and the frequency bars flatten toward equal heights, which is the visual signature of a uniform distribution.
This is also the antidote to the gambler’s fallacy. A run of five heads does not make tails “due” — each flip is independent and stays a 50/50, and the running tally simply drifts toward 50% as the number of flips grows (the law of large numbers), without any individual flip being influenced by the ones before it.