Tool
Random Number Generator
Any range, any count, unique or repeating — true cryptographic randomness.
Random Number Generator
Set a minimum, a maximum, and how many numbers you need -- unique or allowed to repeat -- and get true cryptographically random numbers, not the predictable kind a lot of online generators quietly use.
Works for a single number or a whole batch at once.
You can go as narrow as a 1-to-6 die-equivalent range or as wide as a multi-million-value lottery-style range -- the fairness math scales the same either way.
How the Random Number Generator works — and why it's fair
For any given range, a naive approach (take a random byte, use modulo to squeeze it into the range) introduces a subtle bias whenever the range size doesn't evenly divide the number of possible byte values -- some numbers in the range end up very slightly more likely than others. This tool avoids that with rejection sampling: it draws random values from crypto.getRandomValues and discards any that would fall in the leftover uneven portion, redrawing until it lands cleanly within a range that divides evenly, so every number in your chosen min-max range has a genuinely identical chance of appearing.
For 'unique' mode -- generating several different numbers with no repeats -- the tool doesn't just redraw and check for duplicates in a loop (which gets slow and slightly awkward as the pool shrinks); it uses a partial Fisher-Yates-style draw across the range, pulling numbers out of the available pool one at a time so repeats are structurally impossible rather than filtered out after the fact.
This is the most general-purpose rejection-sampling implementation on the site, since the range itself is arbitrary rather than fixed like the dice roller's die sizes or the letter generator's 26 letters -- the same underlying correction technique just gets applied to whatever range you set.
One more subtlety worth naming: rejection sampling's redraw rate depends on your specific range -- a range that already divides evenly into the underlying random byte space needs zero redraws, while an awkward range size might occasionally need one or two extra draws behind the scenes, all invisible to you and all still landing on a perfectly fair result.
What people generate numbers for
Statistics classes use it to demonstrate genuine randomness versus predictable pseudo-random sequences. Raffle organizers use it to generate ticket numbers. Board gamers use it as a stand-in when a physical die is missing or when they need a number outside the usual 1-6 or 1-20 range. Researchers use it for quick random sampling from a numbered list.
Auditors use unique-mode batches to pick a random sample of record numbers for a spot-check without an obvious, gameable pattern, and quiz-show hosts use it to assign random point values to trivia categories.
For randomizing an entire list's order rather than generating fresh numbers, the list randomizer is the right tool; for picking a specific number of digits like a PIN, the PIN generator is purpose-built for that.
Some people use a large-range single draw as a makeshift lottery number picker, generating one number in a game's actual valid range as a personal pick rather than choosing 'meaningful' numbers like birthdays, which studies suggest cluster player choices and reduce jackpot-splitting odds.
Frequently asked questions
Is this really more random than Math.random(), or just marketing?
It's a real difference -- Math.random() uses a fast pseudo-random algorithm not designed for unpredictability, while crypto.getRandomValues is a cryptographic-grade source built specifically so its output can't be predicted from previous values.
Can it generate negative numbers or decimals?
It's built for whole numbers within a range you set, which can include negative numbers if your minimum is below zero.
How does 'unique' mode actually guarantee no repeats?
It draws from a shrinking pool of remaining numbers rather than redrawing and checking for duplicates, so a repeat is structurally impossible rather than just unlikely.
Is there a maximum range size?
No fairness-related cap -- extremely large ranges just take a fraction longer to compute.
How is this different from the dice roller?
The dice roller is locked to standard tabletop die sizes (d4 through d20); this tool accepts any minimum and maximum you set.
Can I generate numbers with leading zeros, like 007?
The tool generates the numeric value itself; formatting with leading zeros for display is a separate, cosmetic step depending on your use case.
Does a wider range take noticeably longer to compute?
No -- the rejection-sampling overhead is negligible even for very large ranges; results still appear effectively instantly.