Developed by StatCalc.net Team Statistically reviewed by — Senior Statistician & Editor Last updated
Probability

Random Number Generator

Use this random number generator to generate one or more random integers or decimals within any range. Choose whether numbers can repeat, sort the results, and copy or download the generated numbers.

Generate from 1 to 10,000 numbers.
Numbers can appear more than once.
Random numbers are generated securely in your browser. Nothing is sent to the StatCalc.net server.
Generated Numbers
—
—


                

What Is a Random Number?

A random number is a number selected by chance from a defined set or range of possible values. When the numbers are equally likely to be selected, each eligible value has the same probability of being chosen.

For example, if you generate a random integer between 1 and 10, there are 10 possible outcomes. When all outcomes are equally likely, each number has a probability of 1/10 or 0.10 of being selected on a single draw.

If you need to calculate the probability of one or more events occurring, use the Probability Calculator.

A random number does not have to be a whole number. Depending on the application, it can also be a decimal, negative number, or zero.

In statistics, random numbers are used for random sampling, random assignment, probability experiments, and simulations. They are also useful for everyday tasks such as picking a number, rolling a virtual die, choosing a question, or creating a random order.

It is also important to distinguish between generating numbers with replacement and without replacement. With replacement, the same number can appear more than once. However, without replacement ensures each selected number appears only once in the same draw.

The random number generator above allows you to control the range, number type, number of values, and whether repeated numbers are allowed.

How to Use the Random Number Generator

Use the random number generator when you need to pick one or more numbers from a specific range. You can generate whole numbers or decimals and choose whether the same number can appear more than once.

To generate random numbers:

  1. Enter the Minimum and Maximum values for your range.
  2. Enter how many numbers you want to generate.
  3. Choose Integers or Decimals.
  4. Select With Replacement if numbers can repeat or Without Replacement if every number must be unique.
  5. Select Sort Smallest to Largest if you want the results arranged in ascending order.
  6. Click Generate Random Numbers.

The tool will instantly generate random numbers within your range, which you can either copy or download as a CSV file.

Not satisfied with the generated random numbers? The “Generate again” button allows you to generate a new random draw.

Tip. The random number generator includes both the minimum and maximum number in the possible results. For instance, if you generate a random number between 1 and 10, both 1 and 10 will be part of the random numbers.

Quick Random Number Presets

The quick presets let you generate some commonly used ranges without entering the settings manually.

The available presets include:

  • 1–10: Pick one random integer between 1 and 10.
  • 1–100: Pick one random integer between 1 and 100.
  • Die 1–6: Generate a number from 1 to 6, similar to rolling a standard six-sided die.
  • 6 from 1–49: Generate six different numbers between 1 and 49 and arrange them from smallest to largest.

You can change any of these settings after selecting a preset.

Pick a Random Number From Any Range

If you only need to pick one random number, set How Many Numbers? to 1 and enter the smallest and largest numbers you want included in the draw.

For example, the table below shows the settings to use for some common random number ranges.

If You Want to GenerateMinimumMaximum
A random number from 1 or 212
A random number from 1 to 717
A random number from 1 to 818
A random number from 1 to 10110
A random number from 1 to 14114
A random number from 1 to 16116
A random number from 1 to 17117
A random number from 1 to 18118
A random number from 1 to 1001100
A random number from 1 to 100011000

For these examples, keep Number Type set to Integers and click Generate Random Numbers. Both the minimum and maximum are included, so a range from 1 to 8 can return any whole number from 1 through 8.

When all numbers in the range are equally likely, the probability of selecting any particular number is:

Probability = 1 / Number of Possible Values

For example:

  • From 1 to 2, each number has a probability of 1/2, or 50%.
  • From 1 to 7, each number has a probability of 1/7.

If you click Generate Again while using With Replacement, each new draw starts with the same set of possible numbers. A number selected on the previous draw is therefore still just as likely to be selected again.

Generate Multiple Random Numbers

You are not limited to generating one number at a time. Enter the number of results you need in How Many Numbers? to generate up to 10,000 numbers in a single draw.

For example, suppose you need 20 random integers between 1 and 100.

Enter:

  1. Minimum: 1
  2. Maximum: 100
  3. How Many Numbers?: 20
  4. Number Type: Integers

You must then decide whether you want to generate the numbers with replacement or without replacement. This distinction is important when the generated values will be used for sampling.

Random Numbers With Replacement

Choose With Replacement when a number can be selected more than once. After each draw, the selected number effectively goes back into the pool and can appear again.

For example, suppose you generate five numbers from 1 to 10 with replacement. A possible result could be: 3, 8, 3, 5, 8. This is valid because 3 and 8 can each be selected more than once.

Sampling with replacement is useful when:

  • each draw should be independent;
  • repeated values are allowed;
  • simulating repeated dice rolls;
  • running probability experiments; or
  • generating random observations from the same range.

The default setting in this random number generator is With Replacement.

Random Number Generator With No Repeats

Choose Without Replacement when you need random numbers with no repeats. Once a number has been selected, it cannot appear again in the same draw.

For example, generating six integers between 1 and 20 without replacement could produce: 2, 5, 7, 11, 16, 19. Regenerating another sample will produce a completely different result.

This option is useful for:

  • selecting a simple random sample;
  • choosing raffle numbers;
  • assigning people to numbered positions;
  • generating a random order;
  • selecting unique question numbers; or
  • drawing several winners when the same entry should not win twice.

The number of unique values you request cannot be larger than the number of possible values in the range. For example, the integers from 1 to 10 contain only 10 possible values. Therefore, you can generate at most 10 unique integers from this range.

If you generate all 10 without replacement, the result is effectively a random ordering of the numbers 1 through 10.

With Replacement vs Without Replacement

When generating several random numbers, you need to decide whether a number can be selected more than once. In this calculator, you control this using the Sampling Method setting.

The table below summarizes the difference between generating numbers with replacement and without replacement.

With ReplacementWithout Replacement
A number can be selected more than onceEach number can be selected only once
Every draw uses the complete range of possible numbersA selected number is removed from the remaining choices
Best when repeated outcomes are allowedBest when you need unique numbers
Similar to repeatedly rolling a dieSimilar to drawing numbered tickets without putting them back

For example, suppose you want to generate four random integers from 1 to 5. If you select With Replacement, a result such as: 2, 4, 2, 5 is valid because 2 can be selected again after the first draw. However, if you select Without Replacement, every number in the result must be different. Therefore, a possible result would be: 2, 4, 1, 5, but 2, 4, 2, 5 would not be possible because 2 appears twice.

The option you choose depends on what you are trying to do. Use With Replacement when repeated values are allowed or when each draw should be independent. However, if you need a set of unique numbers, such as when selecting people from a numbered population for a simple random sample, use Without Replacement instead.

Generate Random Decimal Numbers

The generator can also produce random decimal values. To produce random numbers with decimals using the generator, select Decimals under Number Type and choose the number of decimal places you want to display.

You can generate values with between 1 and 8 decimal places. For example, to generate five random numbers between 0 and 1 with two decimal places, enter:

  • Minimum: 0
  • Maximum: 1
  • How Many Numbers?: 5
  • Number Type: Decimals
  • Decimal Places: 2

A possible result might be: 0.13, 0.42, 0.68, 0.05, 0.91. Your actual results will be different because the tool generates a new random sample each time.

You can also use negative ranges or ranges that cross zero. For example, setting the minimum to −5 and maximum to 5 allows both negative and positive results.

Sort Random Numbers

By default, the generator shows the numbers in the order it selects them. Keep this order when the sequence of the draw matters. However, if you only care about the selected values and want an easier-to-read list, select Sort Smallest to Largest.

For example, suppose the generator selects: 17, 4, 12, 9, 2. After you turn on sorting, the calculator displays the same numbers as: 2, 4, 9, 12, 17. As you can see, sorting does not generate a new sample. Instead, it only rearranges the numbers you already generated.

You may want to sort the results when you need to:

  • identify the smallest and largest values quickly;
  • scan a long list more easily;
  • compare the generated values; or
  • copy an ordered list into a table or spreadsheet.

Leave sorting off when you need to preserve the original draw order, such as during a simulation or random assignment.

Copy or Download Random Numbers

After generating the numbers, you can copy them directly from the calculator. The calculator allows you to change the format of the generated numbers. The available options are:

  • Comma Separated: 4, 17, 23, 41
  • One Number Per Line: useful for pasting into a spreadsheet column.
  • Space Separated: 4 17 23 41

You can also select Download CSV to save the generated numbers as a CSV file. This is useful when you need to move a large random sample into Excel, Google Sheets, SPSS, R, Python, or another statistical program.

Using Random Numbers in Statistics

Random numbers are useful whenever observations, participants, treatments, or events need to be selected by chance.

Common statistical uses include:

  • Simple random sampling: Assign each member of a population a number and generate unique random numbers to select the sample.
  • Random assignment: Assign subjects or experimental units to treatments using randomly generated values.
  • Simulation: Repeatedly generate random outcomes to study probability or statistical behavior.
  • Bootstrap and resampling concepts: Sampling with replacement is an important part of many resampling procedures.
  • Classroom probability experiments: Generate outcomes that represent dice rolls, numbered cards, or other random experiments.

For example, suppose a researcher has a numbered list of 500 students and wants to select 50 students for a survey.

Enter:

  • Minimum = 1
  • Maximum = 500
  • How Many Numbers? = 50
  • Number Type = Integers
  • Sampling Method = Without Replacement

Each generated number can then be matched to the corresponding student on the list.

Random Number Generator vs Random Sampling

A random number generator creates numbers from a range that you define. On the other hand, random sampling uses chance to select members of a population for a study.

Therefore, you can use the generator as part of a simple random sampling procedure when every member of the population has a unique number.

For example, suppose a population contains 200 people numbered from 1 to 200, and you need a sample of 30 people. Set the generator to produce 30 integers from 1 to 200 without replacement. Each generated number then points to one person on the population list.

The generator helps with the random selection, but it does not guarantee a good sample by itself. You also need a complete population list and a sampling process that gives every eligible member a fair chance of selection.

Common Uses for a Random Number Generator

A random number generator can be useful for much more than statistical sampling. Common uses include:

  • picking a random number for a game;
  • rolling a virtual die;
  • choosing a question or exercise number;
  • selecting a student or participant by number;
  • creating a random order;
  • selecting raffle entries;
  • generating lottery-style number combinations;
  • assigning numbered treatments;
  • running probability simulations; and
  • creating random numerical data for practice.

For example, if eight students are numbered 1 through 8, set the range from 1 to 8 to randomly select one student. However, if there are 14 questions and you want to select one at random, use a range from 1 to 14.

The same approach works for ranges such as 1 to 7, 1 to 16, 1 to 17, or 1 to 18. You only need to change the minimum and maximum values.

Frequently Asked Questions

What is a random number generator?

A random number generator is an online tool that selects numbers by chance from a specified range. This generator can produce one or many integers or decimals, with or without repeated values.

How do I pick a random number?

Enter the smallest and largest possible values, set How Many Numbers? to 1, and click Generate Random Numbers. For example, to pick a random number from 1 to 10, enter 1 as the minimum and 10 as the maximum.

Can I generate random numbers without repeats?

Yes. Select Without Replacement under Sampling Method. Every generated value will then be unique within that draw.

Can I generate random decimals?

Yes. Choose Decimals under Number Type and select between 1 and 8 decimal places.

Can I generate a random number between 1 and 7?

Yes. Set Minimum = 1 and Maximum = 7. Each integer from 1 through 7 is included in the possible results.

Can I download the generated numbers?

Yes. Click Download CSV to save the generated values in a CSV file. You can then open the file in Excel, Google Sheets, or another statistical program.

Cite

Choose APA, MLA, Chicago, or Harvard. Citations credit StatCalc.net as the corporate author.

StatCalc.net. (2026, October 26). Random Number Generator. Retrieved October 26, 2026, from https://statcalc.net/random-number-generator/

About This Calculator

This calculator was developed by the StatCalc.net Team and statistically reviewed by , Senior Statistician & Editor.

Formulas, calculation logic, worked examples, and explanatory content are reviewed for statistical accuracy and clarity.

Add to Preferred Sources