“Picking raffle winners by hand feels biased” or “you need batches of test numbers for your app” - a random number generator solves both.
In this article, we explain how to use a random number generator: picking winners fairly, no-duplicate draws, and the difference between pseudo-random and cryptographically secure randomness.
What is a random number?
A random number is a value generated in a way that cannot be predicted. It is the computer equivalent of rolling dice or drawing lots.
Common uses include:
| Use | Example |
|---|---|
| Draws and raffles | Picking winners, deciding order |
| Test data | Batches of numbers for development |
| Games | Dice rolls, card shuffling |
| Sampling | Random selection for surveys |
Pseudo-random vs cryptographically secure
Computers produce two kinds of random numbers:
| Type | Traits | Best for |
|---|---|---|
| Pseudo-random | Generated by formulas. Fast, but predictable if the seed is known | Games, simulations |
| Cryptographically secure | Practically impossible to predict. Provided by the OS | Draws, passwords, security |
Key point: When fairness matters - like raffles - use a cryptographically secure generator. Tools Hub's generator uses the browser's crypto API (crypto.getRandomValues).
Running a fair draw
Here is how to pick raffle winners fairly.
Step 1: Number the entrants
Assign a number to each entrant. With 50 entries, numbers run from 1 to 50.
Step 2: Set the range and count
In the generator, set minimum “1”, maximum “50” and count “3” (the number of winners).
Step 3: Generate without duplicates
Choose “no duplicates” so the same number never appears twice - no duplicate-winner trouble.
The generated numbers (say 7, 23, 41) identify the winners.
Fairness tip: Results are not stored, so if you need a record of the draw, copy the numbers somewhere safe right after generating.
With duplicates vs without
| Mode | Best for | Note |
|---|---|---|
| No duplicates | Picking winners, deciding order | You cannot generate more numbers than the range allows |
| With duplicates | Dice replacement, statistical samples | The same number can appear multiple times |
Without duplicates, the count cannot exceed the range size (1-50 gives at most 50 numbers). Check the range and count before generating.
Generating test data
Developers often need numeric data to verify behavior:
- Boundary tests: include extremes like 0 and maximum values
- Bulk data: generate 100 numbers at once to check list rendering and performance
- Sorted output: choose ascending order to verify sorting logic easily
Generated numbers can be copied as comma-separated text, ready to paste into a spreadsheet or code.
How to generate random numbers
The Tools Hub random number generator produces fair numbers from just a range and a count.
Set range and count
Enter the minimum, maximum and how many numbers to generate.
Choose options
Pick "no duplicates" for draws, and sort ascending if you like.
Generate and copy
Copy the numbers and use them in your draw or document.
The tool introduced in this article
Random Number Generator
Up to 100 numbers in any range. Cryptographically secure randomness, with nothing saved or sent.
Summary
- Random numbers power draws, raffles, test data and games
- For fairness, use a cryptographically secure generator
- Choose “no duplicates” when picking winners
- Without duplicates, the count is limited by the range
- Copy results right away if you need a record
- The Tools Hub generator runs entirely in your browser
Whenever you need a fair draw, use the steps above or the Tools Hub random number generator.
FAQ
Are the numbers biased?
No. A cryptographically secure generator (crypto.getRandomValues) produces fair, unbiased results.
Can I prevent duplicate numbers?
Choose “no duplicates” and the same number never appears twice. Note that the count cannot exceed the range size.
How many numbers can I generate at once?
Up to 100 at a time. Ascending sort makes the results easier to review.
Are generated numbers saved?
No. Results are displayed only in your browser and never saved or sent. Copy them if you need a record.