The Random Number Generator produces random integers in three modes: basic draws from any range you set, with or without duplicates; dice rolls of one to six dice with two to one hundred sides; and one-tap presets for major lotteries. Use it for giveaways, classroom picks, tabletop games, test data, and deciding who makes the tea.
How It Works
Basic mode without duplicates builds the full pool of integers in your range and draws from it without replacement, so every value can appear at most once and requesting more numbers than the range holds returns an error rather than a quiet duplicate. With duplicates allowed, each draw is an independent uniform pick from the range. Dice mode rolls each die as a uniform pick from 1 to its side count. Lottery mode applies the matching preset (picks and maximum) with duplicates off.
Lottery presets included
| Game | Picks | Numbers from | |---|---|---| | Powerball (main numbers) | 5 | 1 to 69 | | Mega Millions (main numbers) | 5 | 1 to 70 | | UK National Lottery | 6 | 1 to 59 | | Australian Saturday Lotto | 6 | 1 to 45 |
The presets generate the main numbers only. Games with a separate bonus ball drawn from a different pool (the Powerball itself, the Mega Ball) need that ball generated separately; run basic mode with the bonus pool's range for it.
Parameters
| Input | Required | Meaning | |---|---|---| | Mode | Yes | Basic, dice, or lottery | | Min and max | Basic | Inclusive range bounds | | Count | Basic | How many numbers to draw | | Allow duplicates | Basic | Independent draws versus without-replacement draws | | Dice count and sides | Dice | 1 to 6 dice, 2 to 100 sides each |
Worked examples of the logic
Drawing 5 numbers from 1 to 49 without duplicates samples a shrinking pool: after 1, 7, 23, and 41 are drawn, they cannot recur, and the fifth draw comes from the remaining 45 values. Rolling 3 dice with 20 sides returns three independent values each between 1 and 20, where duplicates are natural and expected (two dice showing 14 is ordinary chance, not a bug). Expect duplicates in basic mode with replacement at a surprising rate: drawing 10 numbers from 1 to 100 produces at least one repeat about a third of the time, a small taste of the birthday effect.
Is Math.random random enough?
The generator uses the browser's pseudorandom generator, which is statistically sound for games, sampling, classroom use, and load-testing data. It is not a cryptographic source and should not be used for passwords, tokens, security codes, or anything an adversary profits from predicting. For a raffle with prizes, the honest practice is to fix the range, count, and duplicate rule in writing before drawing, and to draw once, publicly, rather than re-rolling toward a preferred outcome, because the mathematics cannot audit your intentions, only your settings.
Limitations
Ranges and counts must be sane integers; without duplicates the count cannot exceed the range size. Lottery presets reflect the main pools of the named games as stored in the tool and do not track rule changes, supplementary numbers, or regional variants. Results are for entertainment and utility use; no draw here has any standing with any lottery operator.
Fair draws, documented
For giveaways, seat lotteries, and audit sampling, fairness is a procedure, not a feeling. Publish the range, the count, and the duplicate rule before drawing; draw once; record the output with a timestamp or screenshot; and keep any exclusion list (staff, previous winners) defined in advance and applied to the pool before the draw, not by discarding inconvenient results afterward. The without-duplicates mode exists precisely for this: it samples the published pool without replacement, so the process can be repeated by anyone with the same settings and verified as a valid draw, even though the specific numbers will differ run to run.
Frequently Asked Questions
Why did I get the same number twice in basic mode?
Because duplicates were allowed, making each draw independent. Switch duplicates off to sample without replacement, the mode lottery games and most draws actually use.
Can I generate decimal or negative numbers?
The range is integers, but the bounds can be negative: a range from -10 to 10 works exactly as expected. For decimals, generate integers and scale them (generate 0 to 1000 and divide by 100, for example).
Are the lottery presets the full ticket?
Only the main numbers. Bonus balls come from separate pools with their own ranges and are not part of the preset; generate one with basic mode using the bonus range for your game.