The Random Number Generator produces truly random integers within any range you specify. Generate a single number or a list of up to 100 numbers โ with an option to ensure all numbers in the list are unique.
Random Number Generator
Generate random numbers within any range.
How to Use This Calculator
- Single Number: Enter a Min and Max, click Generate.
- Multiple Numbers: Switch to the Multiple tab, enter range and count, check “Unique” if you don’t want repeats, and click Generate.
Uses for a Random Number Generator
- Picking winners: Assign numbers 1โN to each entrant and generate a random number.
- Decision making: Can’t decide between options? Number them and let the RNG decide.
- Games and simulations: Simulate dice rolls, card draws, or random events.
- Statistical sampling: Pick a random subset of items from a list.
- Classroom use: Randomly call on students, randomize quiz question order, or create random groups.
Is Math.random() Truly Random?
Not cryptographically. Math.random() is a pseudorandom number generator (PRNG) โ it produces a sequence that looks random but is deterministic. For casual use (games, decisions, sampling), it is perfectly adequate. For security purposes (generating keys or passwords), use crypto.getRandomValues() โ which our Password Generator uses.
Frequently Asked Questions
Can I get duplicate numbers in the list?
By default, yes. Check the “Unique” checkbox to prevent duplicates. Note: you cannot generate more unique numbers than exist in the range (e.g., you can’t get 5 unique numbers from a range of 1โ3).
What is the maximum range I can use?
Any range supported by JavaScript integers. For practical purposes, you can use any range within the safe integer limit of ยฑ9,007,199,254,740,991.
How it works
Single random integer: Math.floor(Math.random() ร (max โ min + 1)) + min. For unique lists, the algorithm builds a pool of all integers in the range and uses Fisher-Yates partial shuffle to select without replacement.Formula
Random Integer in [min, max] = Math.floor(Math.random() ร (max โ min + 1)) + min