Random Number Generator
Set your range and options, then generate.
Generate one or many random integers or decimals within any range. Choose whether numbers may repeat, control decimal places, and see how random selection works.
Set your range and options, then generate.
A random number generator chooses numbers from a defined range without intentionally following a predictable pattern. For example, suppose you enter Minimum: 1, Maximum: 100. The generator may return 37. Click again and it may return 82. Then 14. The important idea is that the generator is not supposed to choose numbers because one number is "due," "luckier," or more deserving than another. Each possible value is selected according to the rules of the random process.
Random number generators are useful for classroom activities, research samples, games, simulations, assigning groups, drawing winners, testing software, making neutral selections, generating practice problems, and many other situations. The math becomes more interesting when we start asking: What numbers are actually possible? Can the same number appear twice? Does every number have the same chance? What is the difference between choosing with replacement and without replacement? Those are the ideas this page helps explain.
For this CalculateThisWay generator, yes. If the integer range is 1 to 10, the possible results are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. That means there are 10 possible integer values. A useful formula is: Number of Integers = Maximum - Minimum + 1. For 1 through 10: 10 - 1 + 1 = 10. For 5 through 20: 20 - 5 + 1 = 16. The +1 matters because both endpoints are included.
Yes. Suppose Minimum = -5, Maximum = 5. Possible integers include -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5. That gives 5 - (-5) + 1 = 11 possible integers. Zero is a valid number in that range. Negative numbers work exactly the same way.
Suppose you ask the generator for 5 numbers from 1 through 10. If duplicates are allowed, one possible result could be 3, 8, 3, 1, 8. The 3 appeared twice, the 8 appeared twice. That is allowed because every draw is treated independently. Think of it like rolling a die several times: if you roll a 4 on the first roll, nothing prevents a 4 from appearing again.
Now suppose you choose No Duplicates. One possible result might be 3, 8, 1, 6, 10. Once 3 has been selected, it cannot appear again in that result set. This is similar to drawing numbered slips from a bag and not putting each slip back before drawing the next one. Statisticians often describe this as sampling without replacement.
Because only 10 unique integers exist in that range. If duplicates are not allowed, each number can appear only once, and the generator cannot produce 20 different numbers when the pool contains only 10. The correct response is not to repeat values, it is to tell the user the request is impossible. The user can either reduce the requested quantity or increase the range.
Decimals are slightly different because the selected number of decimal places determines how many distinct values exist. Suppose Minimum: 0, Maximum: 1, Decimal Places: 1. The possible values are 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0. That creates 11 distinct values. If you change to 2 decimal places, the grid becomes much finer: 0.00, 0.01, 0.02, and so on through 1.00, now there are 101 distinct values. Precision affects how many unique decimal results can exist.
No. Randomness can produce patterns by chance. Imagine flipping a fair coin. You might get Heads, Heads, Heads, Heads. Some people look at that sequence and think "that cannot be random," but it can be. A random process does not promise that short sequences will always look perfectly balanced. Likewise, a random number generator might produce 7, 8, 9, 10 in that order. The fact that the numbers happen to form a pattern does not automatically mean the process was not random. The important question is how the values were selected.
Not in a small sample. Suppose you generate 10 numbers from 1 through 5 with duplicates allowed. You might see 2, 2, 4, 1, 5, 2, 3, 4, 2, 1. The number 2 appeared more often. That does not automatically indicate bias, random samples naturally fluctuate. As the number of trials becomes very large, a well-designed uniform generator should generally produce frequencies that move closer to the expected proportions, but short runs can look uneven.
12 hypothetical die rolls: 2, 6, 2, 4, 1, 2, 5, 3, 6, 2, 4, 1
Suppose one integer is selected from 1 through 10. If the generator is uniform, each number should have the same probability. There are 10 possible values, so each value has probability 1/10 = 0.10 = 10%. The probability of generating 7 is 10%. The probability of generating 2 is also 10%. No number in the range should receive extra preference.
If duplicates are allowed, every draw can be treated as another random selection from the same pool. Example: 1 through 10, each draw has 10 possible integer values, and the first result does not remove anything from the range. If duplicates are not allowed, the pool changes after each selection. Suppose the first number selected is 4, now 4 is removed, there are 9 remaining numbers. Then 8, now there are 8 remaining. That is why sampling without replacement behaves differently from independent repeated draws.
Computers are machines, and traditional software normally follows instructions deterministically. That creates an interesting problem: how does a computer produce something random? Many computer systems historically use pseudo-random number generators, or PRNGs. A pseudo-random generator uses an algorithm that produces values that behave enough like random numbers for many purposes. The sequence is influenced by a starting state often called a seed. If the exact algorithm and starting seed are known, a pseudo-random sequence may be reproducible. That can actually be useful: researchers and developers sometimes want a repeatable random sequence so an experiment or software test can be reproduced.
Modern browsers also provide stronger random-number capabilities designed for security-sensitive applications. JavaScript exposes this through browser APIs such as crypto.getRandomValues(). This generator uses the browser's secure random source where available to create stronger general-purpose random selection. However, this page is not marketed as a specialized cryptographic-key or password-generation system, use dedicated security tools for those purposes.
This is a more technical issue, but it explains why generating random integers requires care. Computers often begin with random binary values. Those values then need to be mapped into a smaller requested range. Suppose a programmer wants 1 through 10. A tempting shortcut is to take a random integer and simply use the remainder after division by 10. But if the source range is not evenly divisible by 10, some outcomes can receive slightly more possible source values than others, creating modulo bias. A better method discards source values that would cause that uneven mapping before selecting the final number, called rejection sampling. You do not need to perform this calculation, the generator handles it internally. The point is simply that "pick a random number" can involve more mathematics than it appears.
A random sample selects members from a larger group using a random process. Imagine a class of 30 students, each assigned a number 1 through 30. The teacher needs 5 students for a demonstration: set Minimum: 1, Maximum: 30, How Many: 5, Duplicates: No. The generator may return 4, 11, 17, 23, 29, and those numbers identify the selected students. Using No Duplicates matters because the same student should not occupy two spots in the sample.
Teachers might use random selection to choose students to answer, assign students to groups, select practice problems, pick presentation order, generate numbers for math examples, or choose review questions. For example, if a worksheet contains 50 problems, set 1 through 50 and generate 10 unique numbers. Those become the day's practice questions, which can make review assignments easier to vary.
Games use random numbers for dice rolls, card behavior, enemy movement, loot, spawn locations, turn order, procedural generation, and many other mechanics. For example, a six-sided die can be simulated by generating an integer from 1 through 6, and a twenty-sided die from 1 through 20. Repeated random results are expected: rolling a 6 does not prevent another 6 on the next roll. That is why dice-style random generation uses Duplicates Allowed.
Yes, when the options are genuinely interchangeable and you simply want a neutral selection. Example: three restaurants, 1 = Restaurant A, 2 = Restaurant B, 3 = Restaurant C. Generate 1 through 3. If 2 appears, choose Restaurant B. The generator has not determined which restaurant is objectively better, it simply provided a neutral random choice.
Yes, for casual drawings when every eligible entry is assigned a number and the selection process fits your rules. Example: 250 valid entries, numbered 1 through 250, generate 1 random integer, and the resulting number corresponds to the selected entry. However, organizations running regulated promotions, lotteries, contests, or high-stakes drawings may have legal, auditing, documentation, or randomness requirements beyond what a general-purpose web tool provides. This page does not claim to satisfy specialized regulatory requirements.
No. A random generator can create random number combinations, it cannot predict a truly random future drawing. If a lottery number has not appeared recently, that does not mean it is "due." Past independent drawings do not make a particular future number more likely simply because it has been absent. This common misunderstanding is related to the gambler's fallacy. This page does not advertise itself as a lottery prediction tool.
The gambler's fallacy is the mistaken belief that previous independent random events change the probability of the next event. Imagine a fair coin lands Heads five times in a row. Someone may think "Tails has to happen next," but if each flip is independent, the next flip is still 50% Heads, 50% Tails. The previous results do not force the next one. The same idea applies to many random-number situations.
Because that is exactly what random generation allows. If two people both request one number from 1 to 100, one may receive 17, another 82. Neither answer is more correct. A random generator is not solving for one mathematically fixed result, it is making a selection from the allowed pool.
Suppose the randomly selected values are 82, 4, 61, 19, 37. If you choose Smallest to Largest, the display becomes 4, 19, 37, 61, 82. The selection itself has not changed, only the presentation order changed. This is why sorting happens after the random numbers are generated.
Suppose the range is 1 through 10 but you do not want 7. The possible integer pool becomes 1, 2, 3, 4, 5, 6, 8, 9, 10, now 9 possible values. If you request unique results, exclusions also reduce how many different values are available, and the generator accounts for that before attempting the selection.
What should you leave this page knowing? Not just "my random number was 37," but the range the number came from, whether the minimum and maximum are included, what duplicates mean, the difference between selection with replacement and without replacement, why unique results are limited by the size of the available pool, how decimal precision changes the number of possible values, that short random samples do not have to look perfectly balanced, equal probability in a uniform range, the basic difference between pseudo-random and browser secure randomness, that randomness can sometimes create patterns by chance, why independent events do not make a number "due," and when to allow duplicates and when not to. Most importantly: what "random" actually means in this generator.
| Setting | What It Does |
|---|---|
| Minimum | Smallest possible value |
| Maximum | Largest possible value |
| Quantity | How many values to generate |
| Integer | Generates whole numbers |
| Decimal | Generates values with decimal places |
| Duplicates Allowed | A value may appear more than once |
| No Duplicates | Each generated value appears once |
| Decimal Places | Controls decimal precision |
| Sort | Changes display order after selection |
| Exclude | Removes listed values from the eligible pool |
I need one or more random integers or decimals within a range.
You are hereI need to analyze a data set rather than randomly generate values.
Open Statistics Calculator →I need to measure how spread out a set of numbers is.
Open Standard Deviation Calculator →I need percentage, increase, decrease, or percent-change calculations.
Open Percentage Calculator →What is a random number generator?
A random number generator selects numbers from a defined range without intentionally choosing a predictable pattern.
Is the minimum number included?
Yes. This calculator includes the minimum and maximum values in the eligible range where mathematically applicable.
Can the generator use negative numbers?
Yes.
Can it generate decimals?
Yes. Choose Decimal and select the number of decimal places.
Can I generate more than one number?
Yes.
Can random numbers repeat?
Yes, if duplicates are allowed.
How do I generate numbers without repeats?
Choose No under Allow Duplicates.
Why can't I generate 20 unique numbers from 1 through 10?
Only 10 unique integers exist in that range.
What does "without replacement" mean?
Once a value is selected, it is removed from the pool and cannot appear again in that result set.
What does "with replacement" mean?
After a value is selected, it remains available for later draws, so repeats are possible.
How many integers are there from 1 through 100?
100.
How do I count how many integers are in a range?
Use Maximum - Minimum + 1 when both endpoints are included.
Is zero a valid random number?
Yes, if zero lies within the selected range.
Does random mean every number appears equally often?
Not necessarily in a small sample. Random samples naturally vary.
Can random numbers accidentally form a pattern?
Yes. Randomness can produce sequences that look patterned by chance.
What is a pseudo-random number generator?
It is an algorithm that produces number sequences with properties designed to resemble randomness.
Does this generator use Math.random?
It uses the browser's secure random capabilities where available rather than relying solely on Math.random.
What is crypto.getRandomValues?
It is a browser API that provides stronger random data from the browser and operating system.
Is this a password generator?
No. This is a general-purpose random-number tool, not a dedicated password or cryptographic-key generator.
What is modulo bias?
Modulo bias is a subtle unevenness that can occur when random source values are mapped into a smaller range using an inappropriate remainder method.
What is rejection sampling?
It is a method that discards source values that would create uneven range mapping before selecting the final result.
Can I use this to simulate a die?
Yes. Use integers from 1 through 6.
Can I use it to pick students randomly?
Yes. Assign students numbers and generate unique values when each student should be selected at most once.
Can I use it to choose a contest winner?
It can make general-purpose random selections, but regulated or high-stakes contests may have additional legal or auditing requirements.
Can this predict lottery numbers?
No. Random number generation cannot predict an independent future random drawing.
If a number has not appeared recently, is it more likely next?
Not in an independent uniform process. Past results do not make a value "due."
What is the gambler's fallacy?
It is the mistaken belief that previous independent random events change the probability of the next independent event.
What does sorting results do?
It changes only the display order after the values have been selected.
Do decimal places affect how many unique results are possible?
Yes. More decimal places create a finer grid and therefore more possible distinct values within a fixed range.
CalculateThisWay generates values only from the range and settings selected by the user. Integer ranges include both endpoints. When duplicates are allowed, each draw may independently select any eligible value. When duplicates are disabled, selected values are removed from the available pool for that result set. Decimal generation uses the selected number of decimal places to define a finite precision grid. Where supported, the generator uses the browser's secure random-number source and unbiased range mapping rather than relying solely on simple pseudo-random remainder calculations. This is a general-purpose random-selection tool and is not presented as a specialized cryptographic-key or regulated drawing system.