Random Number Generator
Pick numbers within any range β for raffles, games, classrooms, and more.
Why a Simple Dice Roll Isn't Always Enough
You've got 47 raffle tickets in a hat, or maybe you're running a giveaway for 200 Instagram followers. You could fold up little slips of paper, shake them around, and hope the universe is fair β but honestly, who has the time or the hat big enough? That's where a proper random number generator steps in, and it does more than you'd expect.
Random number generation sounds almost too simple to be interesting. Type a minimum, type a maximum, click a button, done. But the moment you start using one seriously β for classroom name picks, game mechanics, lottery draws, even statistical sampling β you realize there are a lot of little decisions that actually matter. Do you want the same number to show up twice? Should the results be sorted so they're easier to read? How many do you need at once? These aren't just cosmetic choices; they change whether the tool is actually useful for your situation.
What "Truly Random" Actually Means (and Why It Matters)
There's a difference between pseudo-random and cryptographically random numbers, and it's worth understanding even if you don't care about the math. Most random number generators β including JavaScript's built-in Math.random() β use a deterministic algorithm seeded by something like the current time. The output looks random to humans, but it's technically predictable if you know the seed. For casual games and raffles, that's completely fine.
This generator uses crypto.getRandomValues() when available β a Web Cryptography API method that pulls entropy from the operating system itself, the same source used for security keys and password generation. It's the same quality of randomness your computer uses to generate encryption certificates. For a raffle, that's total overkill in the best way: nobody can claim the draw was rigged.
There's also the bias problem that most people have never heard of. If your range has 100 numbers but the underlying random byte doesn't divide evenly into that range, some numbers could appear slightly more often than others. This generator corrects for that using a technique called rejection sampling β it simply discards values that would introduce bias and tries again. The result is each number in your range having exactly equal probability of selection.
The No-Repeat Mode: How It Works Under the Hood
Choosing unique numbers without replacement is a classic computer science problem, and the naive approach β pick a number, check if you've seen it before, repeat β works fine when you need 10 numbers from a pool of 10,000. But if you need 9,500 unique numbers from that same pool, you're going to spend a lot of time picking numbers you've already picked. That's called the birthday paradox in reverse, and it makes naive methods crawl to a halt.
This generator uses a partial Fisher-Yates shuffle instead. Imagine laying all the numbers in your range out in a row and shuffling them β then just taking the first N cards off the shuffled deck. You're guaranteed uniqueness, and the time it takes doesn't explode as you approach the upper limit of your range. For ranges up to 100,000 numbers, it builds the pool and shuffles; for larger ranges, it switches to a Set-based approach. You won't notice the difference, but your browser will.
Real Situations Where This Actually Gets Used
Teachers use random number generators constantly β assigning presentation order to students, picking which question to answer next, creating variety in classroom activities without playing favorites. A range of 1β30 for a class of 30 students, no-repeat mode on, sorted: you've got a fair presentation schedule in two seconds.
Tabletop RPG players use them when dice don't have enough sides. Need a random number between 1 and 347 for some elaborate loot table? No physical die exists for that. Game designers prototyping mechanics need to quickly test probability distributions β generate 1,000 numbers and check the spread. Board game tournaments use them for seeding brackets or assigning starting positions.
Survey researchers and statisticians use random number generators for sampling. If you're conducting a random audit of 50 records from a database of 800, you need 50 unique numbers between 1 and 800. Generating them with a proper no-repeat mode and copying the output to a spreadsheet is much faster than using Excel's RAND() function and deduplicating manually.
Online giveaway hosts are probably the biggest casual users. "Comment to enter and I'll pick a winner" β you screenshot the comments, number them 1 through however many entries you got, run the generator once, and you have your winner. The whole process takes under a minute and is completely defensible to anyone who questions fairness.
Getting the Most Out of Multiple Draws
The quantity control is where things get genuinely powerful. Set your range from 1 to 49, choose 6 numbers, enable no-repeats, hit generate: you've got a lottery-style draw. Set it to 1β100, generate 20 numbers sorted in ascending order, and you've got a random sampling grid for a study. The combination of range, quantity, and no-repeat mode covers an enormous variety of use cases that would otherwise require separate specialized tools.
The sort option sounds minor but saves real time. When you're running a raffle and pick 25 winners from numbers 1β500, getting them in ascending order means you can scan down your entrant list in one pass rather than jumping around. Small thing, but when you're managing a live event or have an audience waiting, every second counts.
When to Run It Multiple Times
Sometimes one generate isn't enough β and that's by design. If you're using this for a decision that really matters, running it two or three times and confirming the results feel suitably varied is a reasonable gut-check. If you hit generate six times and keep getting similar clustering, that's worth paying attention to (though with proper randomness it's extremely unlikely).
For elimination-style games β picking who goes first, then second, then third β it's faster to generate the full queue at once with no-repeats enabled than to run separate generations each round. You get the full ordering in one shot and nobody has to wait while you click through multiple rounds.
The Stats Row You Might Have Overlooked
Below your generated numbers, a small stats line shows the count, minimum, maximum, and average of the current batch. This is particularly useful when you're generating large sets and want a quick sanity check that the distribution looks reasonable. If you generate 100 numbers between 1 and 100 and the average is 48.7, that's exactly what you'd expect from a uniform distribution. If it were 22 or 78, you'd want to know something was off. The stats line gives you that at a glance, no separate calculation needed.
Copy the results with one click and paste them wherever β a spreadsheet, a chat message, a tournament bracket doc. The output is clean comma-separated text that plays nicely with Excel, Google Sheets, or just a plain text file. No formatting to clean up, no extra characters to strip out.
A Note on Fairness and Transparency
If you're running a public giveaway or any draw where people expect fairness, it's worth being transparent about your method. Screenshot the tool settings and the result, or record your screen while you run the draw. Showing your range, the quantity setting, and the output all at once removes any doubt. Fairness isn't just about the mathematics β it's about showing your work. A generator that runs in the browser with no server calls is actually better for this: there's no black box on a server that people can't see. What you see is what it does.