Skip to main content
RN

Random Number Generator

Generate one or many random integers within any range, with an option for unique-only results and cryptographically strong randomness.

Did you like the tool? Thanks!
Share:

Uses the browser's cryptographic RNG (crypto.getRandomValues) for uniform, unbiased results.

How to Use Random Number Generator

Set a Min and Max value, choose how many numbers you want (up to 50), and optionally check 'Unique values only' to avoid repeats. Press Generate to produce the numbers, shown as a row of chips. If you ask for more unique values than the range allows, a hint tells you the maximum possible instead of generating a broken result.

About Random Number Generator

A random number generator produces values that are unpredictable and, ideally, uniformly distributed — meaning every possible number in your chosen range has an equal chance of being picked, with no bias toward any particular value. This matters for anything from picking a raffle winner fairly, to shuffling a set of quiz questions, to seeding a simulation or a game mechanic that shouldn't be predictable or gameable by users. Not all "random" number generation is equally trustworthy. A very common but weaker approach uses a general-purpose pseudo-random source designed for things like animations or simple games, but not intended for anything where unpredictability actually matters, such as raffles, lotteries, security tokens, or anything users might have an incentive to predict or manipulate. This tool instead uses the Web Crypto API's cryptographically secure random source, which pulls from the operating system's own random number source — the same quality of randomness used to generate encryption keys — giving genuinely unpredictable results rather than merely "good enough for a game" ones. Getting a uniform distribution from raw random bytes is trickier than it sounds. If you naively take a random 32-bit number and reduce it to your range using the remainder operator, some numbers in your range end up very slightly more likely than others whenever your range doesn't evenly divide the total number of possible 32-bit values, a subtle bias called "modulo bias". This tool avoids that by using rejection sampling: it repeatedly draws a fresh random 32-bit value and only accepts it if it falls within the largest span that divides evenly by your range size, discarding and re-drawing any value that would introduce bias. The result is a genuinely uniform distribution across your Min-Max range, no matter what the range size is. Worked example: setting Min to 1, Max to 6, and Count to 1 simulates a single fair six-sided die roll — over many repeated presses of Generate, each of the six outcomes should occur roughly equally often, thanks to the rejection-sampling approach described above. The "Unique values only" option is useful whenever repeats would be meaningless or unfair, for example drawing 5 raffle winners from 50 entries, or dealing out a set of distinct random positions. Internally, when this option is checked, the tool builds the complete list of every integer in your range, then shuffles that list using the Fisher-Yates algorithm, a well-studied, unbiased shuffling method that guarantees every possible ordering is equally likely, before taking the first "Count" values from the top. This differs from simply generating random numbers and discarding duplicates one at a time, which becomes slow and can technically bias later selections as the pool of acceptable values shrinks. A common misconception is that requesting, say, 10 unique values from a range of only 5 possible integers (1 to 5) should just return however many unique values it can, silently ignoring the rest of your request. Doing that quietly would hide a real input mistake. Instead, this tool tells you directly how many unique values are actually possible in your chosen range, and caps generation there, so you immediately understand why you didn't get the count you asked for.

Details & Tips

How the randomness works: the randomInt helper draws a random 32-bit integer with the Web Crypto API and uses rejection sampling — values above the largest multiple of the range size that fits inside the 32-bit space are discarded and re-drawn, guaranteeing a perfectly uniform result with no modulo bias, however oddly-sized your Min-Max range is. Non-unique generation: when "Unique values only" is unchecked, the tool simply calls the random integer helper once per requested Count, allowing the same number to appear more than once, exactly like rolling a die repeatedly, where getting the same face twice in a row is completely normal and expected. Unique generation with a Fisher-Yates shuffle: when "Unique values only" is checked, the tool builds an array containing every integer from Min to Max, then shuffles it with the Fisher-Yates algorithm — starting from the last element, repeatedly swap it with a randomly chosen earlier element, using the same crypto-backed randomness for the swap position, working backward to the front of the array. The first "Count" values from the shuffled array become your result, a method that guarantees every possible unique selection and ordering is equally likely, unlike naive generate-and-discard-duplicates approaches. Worked examples: Min 1, Max 49, Count 6, with Unique checked, simulates drawing 6 unique numbers for a lottery-style draw, each equally likely to appear in any position. Min 1, Max 100, Count 20, with Unique unchecked, produces 20 independent random numbers between 1 and 100, where repeats are allowed and expected roughly 1 in 5 times for a range this size. Edge cases this widget handles: Max less than Min is rejected with a clear validation message rather than silently swapping the values or producing an empty result. Count above 50 is capped at 50, since larger batches add little practical value for a quick lookup tool and this keeps the chip display readable. Requesting more unique values than the range contains, such as 10 unique values from a range of only 5 integers, shows "Only 5 unique values are possible in this range" and caps generation at that maximum instead of erroring out or hanging. Count below 1, or non-numeric Min/Max/Count fields, are all rejected with a plain-language validation message. Practical tip: for anything where fairness genuinely matters, such as assigning raffle prizes, picking review order for submissions, or randomly selecting participants for a study, always check "Unique values only" if repeats shouldn't be possible, and keep a note of the exact Min, Max, and Count you used, since that's the information anyone auditing the draw for fairness would want to see alongside the result.

Frequently Asked Questions

How random are these numbers really?
They're generated using the Web Crypto API's cryptographically secure random source, the same quality of randomness used for encryption keys — not a weaker general-purpose random function.
What does "Unique values only" do?
It ensures no number repeats in your results, using a shuffle of every possible value in your range rather than generating and discarding duplicates.
What happens if I ask for more unique values than the range allows?
The tool tells you the maximum possible, "Only N unique values are possible in this range", and caps generation there.
What is the maximum Count I can request?
50 numbers per generation.
Can Min and Max be negative?
Yes — any whole-number Min and Max are supported, as long as Max is greater than or equal to Min.
Why not just use a simple Math.random()-style generator?
It isn't designed for cases where true unpredictability matters, like raffles or fair draws; this tool uses a cryptographic source instead.
What is "modulo bias" and why does it matter?
It's a subtle unfairness that can occur when reducing a random number to a smaller range using simple division remainder; this tool avoids it with rejection sampling.
Can I use this to simulate dice rolls?
Yes — set Min to 1 and Max to 6, or 20 for a d20, and Count to however many dice you want to roll at once.
Does each Generate press give a completely new result?
Yes — every press draws fresh random values; nothing is cached or repeated from a previous generation.
Can I generate the same number twice if uniqueness isn't checked?
Yes — with "Unique values only" unchecked, repeats are allowed and expected, just like rolling a die multiple times.
Is this suitable for a real raffle or giveaway?
Yes — the cryptographic randomness and Fisher-Yates shuffle for unique draws make it suitable for genuinely fair selection.
Why do I see results as chips instead of a list?
It's a compact, easy-to-scan way to display many numbers at once, especially useful for larger counts.

Part of These Collections

Also Available As

random number picker, number generator, raffle picker, random integer generator, lottery number generator, dice roller

Found a Problem?

Let us know if something with Random Number Generator isn't working as expected.

Thanks — we'll take a look.