Random Number Generator
Creator
Reviewer
Random Number Generator
Comprehensive Version
Decimals allowed
Decimals allowed
Up to 200
Set a minimum, a maximum and how many numbers you need, then press Generate. Each press draws a fresh set of whole numbers from within your range, and you can choose whether the same number is allowed to come up more than once. It works for anything from running a plain random number generator 1-100 (or a number generator 1-100 for a shorter search) to drawing a full set of unique raffle winners or lottery-style picks.
Need more than whole numbers? Use the Comprehensive Version card below for lower and upper limits that can be decimals, a choice between Integer and Decimal output, and, in Decimal mode, a precision setting for exactly how many digits follow the decimal point, even hundreds of them.
How the random number generator handles range and duplicates
Every number this tool produces is a whole number somewhere between the min and max you enter, both ends included. Behind the scenes, each draw scales a random fraction between 0 and 1 up to the width of your range, then rounds down to land on one whole number inside it, so every value in the range has an equal chance of being picked on any single draw.
The “allow duplicate numbers” option decides whether that draw happens with or without replacement. With duplicates allowed, each number is drawn completely independently of the ones before it, so the same value can appear more than once in your results, exactly like rolling a die several times in a row. With duplicates turned off, the tool instead shuffles every possible value in your range and hands you the first however-many you asked for, so no value can repeat, the same way a raffle drum or a lottery machine never draws the same ball twice in one round.
That distinction has a hard limit built into it. If duplicates are off, the range has to contain at least as many possible values as the count you are asking for. Ask for 15 unique numbers from a range of 1 to 10, and the request fails outright, naming the range size, rather than silently returning fewer numbers than you asked for or getting stuck trying to find one more unique value that does not exist.
The Comprehensive Version: decimal limits and adjustable precision
The Comprehensive Version card starts from the same idea as the Random Number Generator card above it, a lower limit and an upper limit, but both fields now accept decimals, and a Result Type toggle lets you choose whether the output should be a whole number or a decimal. It is the version to reach for whenever the plain min/max/count fields above it are not quite enough, whether that means a range with a fractional edge, like 1.5 to 9.5, or a result that needs a fractional part of its own.
With Integer selected, decimal limits are narrowed to the whole numbers they actually contain: a lower limit of 1.5 and an upper limit of 4.2 narrows to the range 2 to 4, since neither 1 nor 5 falls inside what you typed. If no whole number sits inside your limits at all, a lower limit of 1.1 and an upper limit of 1.9, say, the tool says so rather than rounding to a number you never asked for. This is also the card to use for a longer code-style number, such as a 4-digit or 6-digit random number: set the lower limit to 1000 and the upper limit to 9999 for a 4-digit result, or 100000 to 999999 for 6 digits.
With Decimal selected, the Precision field sets exactly how many digits follow the decimal point, from a single digit up to several hundred. Every one of those digits is generated independently and assembled as text, not calculated as an ordinary floating-point number, which is what makes a high precision setting possible at all. A plain number only reliably holds around 15 significant digits before more of them stop carrying any real information, purely because of how computers store floating-point values, so a precision far beyond that would be meaningless, or would simply fail, if it were computed the usual way. Generating each digit directly sidesteps that ceiling entirely, at one honest trade-off: the result is a piece of text built to look like a very precise decimal for you to read or copy, not a number a spreadsheet formula could do further maths on.
Quick settings for common picks
Every pick below is the same two fields, Min and Max, with Count set to 1. Turning duplicates off and raising Count gives a non repeating random number list, and a range such as 1 to 49 with six numbers works as a lottery-style quick pick. For dice that need rolling in a game, the dice roller handles several dice at once.
| What you want | Min | Max | Note |
|---|---|---|---|
| Pick a number 1-10 | 1 | 10 | Quick decisions and guessing games |
| Pick a number 1-100 | 1 | 100 | Classic guess-the-number range |
| Pick a number 1-5 | 1 | 5 | Small groups and rating picks |
| Pick a number 1-4 | 1 | 4 | Also a random number from 1-4 for four options |
| Pick a number 1-20 | 1 | 20 | One roll of a twenty-sided die |
| Number generator 1 to 16 | 1 | 16 | Drawing a place in a 16-slot bracket |
| Roll a d6 | 1 | 6 | One six-sided die; draw again for each extra die |
| Roll a d4 | 1 | 4 | One four-sided die |
| 3 sided die | 1 | 3 | Rock, paper, scissors or any three-way pick |
| 5 sided dice | 1 | 5 | One five-sided die |
| Flip a coin | 1 | 2 | 1 for heads, 2 for tails |
Common uses
Between the two cards, a handful of controls cover a surprising number of everyday situations. A few of the most common:
- Picking a single random number. Set min and max to the bounds you need, count to 1, and press Generate for a one-off pick, whether that means a full random number generator 1-100 request or a quick pick a number between 1 and 10 to decide who goes first in a game.
- Raffle or giveaway winners. Turn duplicates off, set count to how many winners you need, and set the range to match your entry numbers, so nobody can be drawn twice: a random number generator no repeats setup, by design.
- Splitting people into teams. Assign each person a number from 1 up to the group size, generate that many unique numbers, and use the order they come out in to build teams or a random speaking order.
- Lottery-style number sets. Set the range to match your lottery’s actual number pool and generate a unique set the same size as a real draw, useful for practicing picks or generating a set of numbers to play.
- Simulating dice or repeated draws. Leave duplicates allowed and set the range to match a die or spinner, then generate several numbers at once to simulate a series of rolls. For dice-shaped output specifically, including a dnd dice roller for tabletop games with d4, d8, d20 and other polyhedral dice, the dice roller is the dedicated tool for that.
- Multi-digit codes. Use the Comprehensive Version in Integer mode with a range like 1000 to 9999 for a 4-digit random number, or 100000 to 999999 to use it as a 6 digit random number generator, whenever you need a placeholder number that is not meant to double as a real security credential.
- Decimals with a specific number of digits. Use the Comprehensive Version in Decimal mode when a whole number will not do, such as generating sample measurements or test data that needs a consistent number of decimal places.
Choosing a sensible range and count
Min and max only need to satisfy one rule: min cannot be greater than max. Both can be negative, both can be the same number, and the range does not need to start at zero or one. A range of -10 to 10 is just as valid as 1 to 100, which is useful if you are simulating something like a temperature swing or a profit-and-loss scenario rather than a simple pick.
How many numbers you ask for interacts with the duplicates setting. With duplicates allowed, count can be any size, since the same value is always free to come up again; with duplicates off, count is capped by how many distinct values exist in your range, so a range of 1 to 6 can never return more than 6 unique numbers. Hit that ceiling and either widen the range or lower the count.
It is also worth deciding up front whether order matters. If you are drawing raffle winners in the order they should be announced, treat the first number back as the first winner; if only which numbers were picked matters, feel free to sort the results yourself afterward, since the tool does not reorder them for you.
An honest limitation: this is not cryptographically secure
Both versions on this page are built on JavaScript’s standard Math.random() function, including the independent digit draws behind the Comprehensive Version’s Decimal mode. That makes it fast, and more than good enough for games, classroom demonstrations, raffles, and everyday decision-making. It is not, however, built to resist someone who is deliberately trying to predict its output.
Math.random() is a pseudorandom number generator: it produces numbers that look random and pass ordinary statistical tests, but they are generated by a deterministic algorithm from an internal seed, not sampled from real-world physical randomness. In some JavaScript engines, enough observed outputs can in principle let someone reconstruct that internal state and predict future numbers. For picking a raffle winner or rolling a virtual die, that theoretical weakness is irrelevant. For anything where a wrong answer could let someone steal money or access, it matters a great deal.
So plainly: do not use this tool, or any tool built on Math.random(), to generate passwords, encryption keys, PINs, security tokens, or anything else where predictability would be a security failure. Use a generator built specifically for that purpose, one based on a cryptographically secure source such as the Web Crypto API, instead.
Frequently asked questions
Is this generator truly random?
Can I use this for a lottery-style draw or raffle?
Why would I want duplicates allowed?
Why would I want duplicates turned off?
Is this safe to use for generating a password or a secret key?
Why does it say I cannot generate more unique numbers than the range allows?
Can min and max be negative, or the same number?
Do decimal values work for min or max?
What does the Precision field do in the Comprehensive Version?
Why generate decimal digits as text instead of as an actual number?
Is this the same thing as a spinning number wheel?
Related tools: Fraction Calculator, Long Division Calculator and Binary Calculator. More are grouped under Math Calculators, and every tool on the site is listed at all calculators.
