Random Number Generator

Set your range and options, then generate.

Both the minimum and maximum are included in the possible range.
Each draw is independent, so the same number may appear more than once.
Your Random Number

What Is a Random Number Generator?

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.

What Numbers Can Be Chosen?
Min = 1
17
52
88
Max = 100
Every integer from 1 through 100 is in the possible range. 17, 52, and 88 are just three of the values that could be selected.

Are the Minimum and Maximum Included?

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.

Can the Range Include Negative Numbers?

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.

A Negative-to-Positive Range
Min = -5
0
Max = 5
All 11 integers from -5 through 5, including zero, are possible results.

What Does "Allow Duplicates" Mean?

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.

What Does "No Duplicates" Mean?

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.

With vs. Without Replacement

Duplicates Allowed

12345
Draw 3, put it back. The next draw may also be 3.
Label: With Replacement

No Duplicates

31245
Draw 3, do not put it back. Only 1, 2, 4, 5 remain.
Label: Without Replacement

Why Can't I Request 20 Unique Numbers from 1 to 10?

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.

What About Unique Decimals?

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.

More Decimal Places = More Possible Distinct Values
0 to 1, 0 places0, 1 (2 values)
0 to 1, 1 place0.0, 0.1, 0.2 ... 1.0 (11 values)
0 to 1, 2 places0.00, 0.01, 0.02 ... 1.00 (101 values)

Does Random Mean Every Result Must Look Mixed Up?

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.

Does Randomness Mean Every Number Will Appear the Same Number of Times?

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.

A Small Random Sample Does Not Have to Be Perfectly Balanced

12 hypothetical die rolls: 2, 6, 2, 4, 1, 2, 5, 3, 6, 2, 4, 1

1×2
2×4
3×1
4×2
5×1
6×2
A small random sample does not have to be perfectly balanced. These exact frequencies are not what every 12-roll sample should look like, they are just one possible outcome.

What Does "Equally Likely" Mean?

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.

What Happens If I Generate More Than One Number?

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.

What Is a Pseudo-Random Number?

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.

What Is Cryptographic Randomness?

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.

Two Ways to Produce a Random-Looking Sequence

Pseudo-Random

Algorithm + Seed
Sequence of values

Browser Secure Random

Browser / OS entropy
Random bytes
Range mapping → Result

What Is Modulo Bias?

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.

What Is a Random Sample?

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.

How Can Teachers Use a Random Number Generator?

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.

How Can Random Numbers Be Used in Games?

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.

Dice as a Random Range
1
2
3
4
5
6
Possible range: 1 through 6, each outcome about 16.67%. Roll 1 → 4, Roll 2 → 4. Repeats are valid.

Can I Use Random Numbers to Make a Decision?

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.

Can I Use a Random Number Generator to Pick a Winner?

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.

Can a Random Number Generator Predict Lottery Numbers?

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.

What Is the Gambler's Fallacy?

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.

Independent Events
H
H
H
H
H
Next flip: Heads 50%, Tails 50%. Previous independent results do not make the other result "due."

Why Might Two Random Generators Give Different Results?

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.

What Does Sorting Random Results Do?

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.

What If I Exclude a Number?

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.

Real Ways to Use the Random Number Generator

Example 1: One Random Number. Range 1 through 100, How Many: 1, Type: Integer.
Possible result: 37
37 is one of 100 possible integers.
Example 2: Five Unique Numbers. Range 1 through 20, How Many: 5, Duplicates: No.
Possible result: 2, 7, 11, 15, 19
No value repeats within this result.
Example 3: Dice Roll. Range 1 through 6, How Many: 1, Duplicates: Yes.
Possible result: 4
Each integer represents one face of a standard six-sided die.
Example 4: Classroom Sample. 30 students, generate 5 unique integers from 1 through 30.
Possible result: 3, 8, 14, 22, 27
Each number can represent one student.
Example 5: Negative Range. Minimum -10, Maximum 10.
Possible result: -6
Negative values and zero are part of the eligible range.
Example 6: Decimal. Minimum 0, Maximum 10, Decimal Places: 2.
Possible result: 6.42
The result is selected from the two-decimal-place grid in the range.

Try It Yourself

How many unique integers exist from 1 through 20?

Random Number Settings at a Glance

SettingWhat It Does
MinimumSmallest possible value
MaximumLargest possible value
QuantityHow many values to generate
IntegerGenerates whole numbers
DecimalGenerates values with decimal places
Duplicates AllowedA value may appear more than once
No DuplicatesEach generated value appears once
Decimal PlacesControls decimal precision
SortChanges display order after selection
ExcludeRemoves listed values from the eligible pool

Random Number Generator or Another Math Tool?

Random Number Generator

I need one or more random integers or decimals within a range.

You are here

Statistics Calculator

I need to analyze a data set rather than randomly generate values.

Open Statistics Calculator →

Standard Deviation Calculator

I need to measure how spread out a set of numbers is.

Open Standard Deviation Calculator →

Percentage Calculator

I need percentage, increase, decrease, or percent-change calculations.

Open Percentage Calculator →

Fraction Calculator

I need fraction arithmetic or conversions.

Open Fraction Calculator →

Questions People Actually Ask

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.

Random Number Methodology

How This Generator Works

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.

This generator is provided for general-purpose random selection, sampling, games, classroom use, and similar tasks. It is not intended for generating passwords, cryptographic keys, or security credentials, and it is not designed to satisfy the legal, auditing, or regulatory requirements of licensed lotteries or high-stakes drawings. Past results never change the probability of future independent draws.