Random Number Generator
Generate one or many random whole numbers between any min and max, using your browser's secure randomness — no bias, no signup.
We use cookies and similar technologies to enhance your browsing experience, analyze site traffic, and personalize content and ads. By clicking "Accept", you consent to our use of cookies. Learn more in our Privacy Policy.
Generate one or many random whole numbers between any min and max, using your browser's secure randomness — no bias, no signup.
A Random Number Generator produces integers inside a range you choose, for example 1 to 100 or 0 to 4,294,967,295. This one generates each number using your browser's cryptographic random source rather than a seeded pseudo-random function, and it rejects values that would skew the distribution, so every integer in the range is equally likely. You set the minimum, maximum, and how many numbers you want, and it returns the result instantly.
It runs entirely in your browser. Nothing is sent to a server, no account is required, and the numbers are generated on your device, which matters when you are drawing winners, picking samples, or generating values you do not want logged anywhere. Use it for dice rolls, raffle draws, test data, A/B bucket assignment, random sampling, or any time you need numbers you can trust to be fair.
You give it three inputs: the minimum (inclusive), the maximum (inclusive), and the count of numbers to generate. It then draws from your browser's cryptographic random source and maps each draw into your range without bias.
Key behaviour:
1 to 6 can return 1 or 6.random % rangeSize, which makes some numbers slightly more frequent. This tool discards out-of-range draws and re-rolls, keeping every value equally likely.Because it is client-side, generation is instant and works offline once the page has loaded.
Say you are running a giveaway with 4,200 entries numbered 1 through 4200, and you need to pick 3 distinct winners.
Set:
142003A possible result:
2871
149
3380
Each entry had exactly a 3-in-4200 chance of being drawn, and no entry could win twice because uniqueness was enabled. If you wanted dice instead, set min 1, max 6, count 5, uniqueness off, and you might get 4, 4, 1, 6, 2 — repeats are expected there.
The equivalent unbiased logic in JavaScript looks like this:
function randInt(min, max) {
const range = max - min + 1;
const maxValid = Math.floor(0xFFFFFFFF / range) * range;
let x;
do {
x = crypto.getRandomValues(new Uint32Array(1))[0];
} while (x >= maxValid); // reject to avoid modulo bias
return min + (x % range);
}
0 or 1, or 0 to 9 for ten buckets).For anything where fairness or auditability matters, the combination of a cryptographic source and on-device generation is the point: you can show the draw happened in front of you, and there is no server log to question.
1 and 5, that is impossible — there are only 5 values. Widen the range or turn uniqueness off.0 to 9 yields ten possible values, not nine. To pick an array index, use min 0 and max length - 1.The fast, wrong way to squeeze a random 32-bit number into a smaller range is value % rangeSize. The problem: 2^32 is rarely an exact multiple of your range. Suppose your raw source returns 0 to 99 and you want 0 to 6 (7 values). 100 / 7 = 14 with a remainder of 2, so the values 0 and 1 each get 15 of the 100 source outcomes while 2 through 6 get only 14. The low numbers come up slightly more often.
The fix is rejection sampling: define the largest multiple of rangeSize that fits in the source space, and throw away any draw at or above it before taking the modulo. That removes the leftover that caused the skew. The cost is occasionally re-rolling, but for any sane range the re-roll rate is tiny and the distribution becomes exactly uniform. This is why a Math.random()-and-modulo snippet is fine for a casual dice roll but not for a fair raffle or a security-sensitive draw.
Math.random() is a pseudo-random generator: a deterministic algorithm with internal state that produces a sequence which only looks random. It is fast and fine for animations, jitter, or non-critical shuffles, but its output can be statistically weak and, in principle, predictable once enough values are observed.
This tool uses the browser's cryptographically secure generator (the crypto.getRandomValues family), which is seeded from the operating system's entropy pool. Practically, that means:
The trade-off is that it is not reproducible. For fairness that is a feature, not a limitation.
It uses your browser's cryptographically secure random source, which is seeded from operating-system entropy. That makes the output unpredictable and statistically uniform, which is as close to true randomness as software gets on a normal device.
Yes. Both ends are reachable, so a range of 1 to 6 can return 1 or 6, and a range of 0 to 9 has exactly ten possible values.
Turn on the uniqueness option. The tool then returns distinct values only, which is what you want for raffles and lottery-style draws. The requested count must not exceed the number of values in your range.
Modulo bias happens when naive code maps a large random value into a smaller range with the % operator, making some numbers slightly more frequent. This tool uses rejection sampling to discard skewing values, so every number in the range is equally likely.
No. Because the source is cryptographic rather than seeded, identical inputs produce different output each time. If you need a repeatable sequence for testing, use a seeded generator in your own code.
No. The numbers are generated in your browser on your device. Nothing is uploaded or logged, which is why it is suitable for draws and codes you want to keep private.
Yes. Once the page has loaded, generation runs entirely on your device, so it keeps working without a network connection.
You can generate across the full unsigned 32-bit range (0 to 4,294,967,295). For most uses — dice, raffles, sampling, PINs — your range will be far smaller, and any of those work instantly.