How to generate a random number
Enter the smallest and largest allowed values, then press generate. The tool picks a whole number inside that range, including both endpoints. If you need several picks, use the quantity field and decide whether duplicates should be allowed before generating the list.
Inclusive endpoints are important. A range of 1 to 10 can return 1, 10, or any whole number between them. A range of 0 to 100 can return 0 and 100. If you are matching a worksheet, raffle list, or game table, check whether the source expects the highest value to be included before using the result.
How unique random numbers work
When unique mode is on, each generated number appears only once. If the range has fewer values than the requested quantity, the calculator limits the result to the available range.
Unique mode is like drawing numbered slips from a container without putting them back. Repeated mode is like rolling dice: the same number can appear again because each draw is independent. Neither mode is always better; the right choice depends on whether repeats make sense for your task.
What can random numbers be used for?
Random numbers are useful for games, classroom activities, giveaways, practice problems, draft orders, decision making, and simple simulations.
Examples include choosing a numbered seat, assigning presentation order, picking practice questions, creating quick sample data, deciding which chore goes first, rolling a virtual die, or selecting a random row from a small spreadsheet. For classroom use, the copy button makes it easy to paste a generated list into notes or a slide.
Unique numbers vs repeated numbers
Use unique numbers when every selected value should appear only once, such as assigning raffle positions, practice problems, or turn order. Allow repeats when each draw should be independent, such as rolling a virtual die several times or creating sample data where the same value can naturally appear again.
Need
Mode
Reason
Assign 10 students to order numbers
Unique
No two students should get the same turn.
Roll a six-sided die 20 times
Repeats allowed
A real die can land on the same value repeatedly.
Pick 5 raffle ticket numbers
Usually unique
A ticket should not be selected twice in the same draw.
Common random number mistakes
Check the minimum and maximum before using the result. Many mistakes come from accidentally excluding the top number, asking for more unique numbers than the range allows, or using a casual random tool for a situation that requires audited or cryptographic randomness. For passwords, security tokens, official drawings, or compliance-sensitive work, use a purpose-built system instead of a simple browser helper.
This generator is meant for everyday randomness, not secure randomness. It is appropriate for games, teaching examples, and casual selection, but not for encryption keys, account recovery codes, regulated contests, or anything where a record of the drawing process must be preserved.
Worked Example & PRNG vs. CSPRNG Methodology Comparison Table
To map a continuous uniform random float $u \in [0, 1)$ to an inclusive integer range $[\min, \max]$, the generator evaluates the discrete uniform formula $\text{Result} = \lfloor u \times (\max - \min + 1) \rfloor + \min$. Worked Example: If you need 5 unique raffle winners from 250 numbered tickets ($\min = 1, \max = 250$), each ticket holds an initial probability of $1 / 250 = 0.40\%$. With unique mode enabled (sampling without replacement), the second draw selects from the remaining 249 tickets ($1 / 249 \approx 0.4016\%$), guaranteeing five distinct winners in a single batch.
| Generator Class |
Browser / Standard API |
Underlying Algorithm / Standard |
Modulo / Range Properties |
Recommended Use Cases |
| Standard PRNG (Pseudo-Random) |
Math.random() (ECMA-262) |
xorshift128+ (64-bit state) |
Fast uniform distribution over $2^{53}$ floats |
Classroom picks, tabletop dice, casual raffles, simulation drills |
| Cryptographic CSPRNG |
crypto.getRandomValues() |
NIST SP 800-90A / FIPS 140-3 OS entropy pool |
Unpredictable state; rejection sampling prevents modulo bias |
Passwords, cryptographic salts, security tokens (Password Generator) |
| Sampling With Replacement |
Unique Mode: Off |
Independent identically distributed (i.i.d.) draws |
Probability per outcome remains $1 / (\max - \min + 1)$ on every draw |
Dice rolls, Monte Carlo trials, independent synthetic test data |
| Sampling Without Replacement |
Unique Mode: On |
Set-deduplicated / Fisher-Yates permutation subset |
Maximum unique count equals $\max - \min + 1$ |
Giveaway winners, student presentation order, lottery ticket sets |
Random number FAQ
Can the minimum random number be negative?
Yes. You can enter negative or positive integers as long as the minimum value is less than or equal to the maximum value.
Why did I get the same random number twice?
Independent random draws allow repeats by default (sampling with replacement), just like rolling a die multiple times. Check "Do not repeat numbers when possible" to sample without replacement.
What is the difference between PRNG (Math.random) and CSPRNG (Web Crypto API)?
Standard browser PRNGs such as Math.random() use fast algorithms like xorshift128+ suitable for games, raffles, and classroom sampling, whereas Cryptographically Secure Pseudo-Random Number Generators (CSPRNG) defined under W3C Web Crypto API (crypto.getRandomValues) and NIST SP 800-90A use OS entropy pools for security-critical keys and passwords.
How do I pick N unique winners from a numbered list without bias?
Set the Minimum to 1, the Maximum to your total number of entries (for example 250), enter the number of winners in "How many numbers", and enable "Do not repeat numbers when possible" so each ticket number can only be drawn once.