Skip to content

Math & Geometry

Random Number Generator

See how many outcomes a range has and how likely each number is. The generator gives every value in the range the same chance, with both endpoints included.

Use calculator

Tool updated

Random numbers are generated in your browser. The Secure source uses the browser's cryptographic generator, but this tool is not meant for creating passwords or encryption keys, and it cannot improve your chances in games of chance.

Quick start

From 1 to 10,000.

1 to 10.

Separate with commas or spaces, for example 13, 666.

Each number can appear only once, like drawing from a hat.

Randomness source
100 possible values

Worked example

Find the chance of each number from 1 to 100

Enter a minimum of 1 and a maximum of 100. There are 100 โˆ’ 1 + 1 = 100 possible whole numbers.

Chance of any one number = 1 รท 100 = 1%; the long-run average is (1 + 100) รท 2 = 50.5

Repeats are normal when duplicates are allowed. Ten numbers from this range have about a 37% chance of containing at least one repeat. Turn on No duplicates to prevent them.

Back to the calculator

How to use the calculator

  1. Choose the type: whole numbers, decimals, or a shuffled sequence.
  2. Enter the minimum and maximum. Both are included, and negative numbers are allowed.
  3. Enter how many numbers you want, from 1 to 10,000. For decimals, set the number of decimal places.
  4. Turn on No duplicates if each number may appear only once, and add any numbers to exclude.
  5. Choose how to sort the results, or keep the order generated.
  6. Choose Secure randomness for fair draws and anything that must be unpredictable, or Standard for casual use.
  7. Press Generate. Press Generate again for a new set.
  8. Copy the numbers, download a TXT or CSV file, or review earlier sets in the history. Copy the link to save your settings.

Calculator Overview

This free Random Number Generator creates one or many random numbers between any minimum and maximum you choose. Generate whole numbers or decimals, allow repeats or require unique numbers, sort the results, exclude numbers you do not want and shuffle a full sequence from the minimum to the maximum. The results appear instantly and you can generate again with one click.

It also lets you choose where the randomness comes from. The Secure option uses crypto.getRandomValues, the browser's cryptographically secure generator, while the Standard option uses Math.random, a fast pseudo-random generator that is fine for games and casual sampling. The tool explains the difference, and uses unbiased sampling so every value in the range has exactly the same chance, including both endpoints.

For sets of numbers, the tool shows the count, smallest, largest, average and sum, and counts repeated values. When repeats are allowed it shows the chance that at least one repeat would occur for your settings, a helpful way to understand why duplicates are normal in random data. A history keeps your recent sets for the current visit, and you can copy the numbers or download them as a TXT or CSV file.

Use it for picking a number for a game, rolling dice or flipping a coin, choosing raffle or giveaway winners, assigning turn order, creating sample data, selecting items for a test or generating numbers in a lottery format. The numbers are generated in your browser and are not sent anywhere. This tool is not meant for creating passwords or encryption keys, and it cannot improve your chances in any game of chance.

Formula

Loading formula...

Formula and Step-by-Step Example

A random whole number between a minimum and a maximum, both included, can take N = maximum โˆ’ minimum + 1 different values. If the generator is fair, each value has the same probability, 1 รท N, and the long-run average of many draws is the midpoint, (minimum + maximum) รท 2. For a die from 1 to 6, N is 6, each face has a 1 in 6 chance, and the average roll is 3.5.

To pick a value, the tool draws a random integer from 0 to N โˆ’ 1 and adds it to the minimum. When N does not divide evenly into the number of outputs of the underlying generator, a plain remainder would make some values slightly more likely. The tool avoids that with rejection sampling: it discards the few draws that fall in the uneven tail and draws again.

When duplicates are not allowed, the tool draws without replacement using a partial Fisher-Yates shuffle, so every possible set and order is equally likely. Decimals are chosen from the grid of values with the number of places you pick, between the minimum and maximum inclusive, so every grid value has the same chance. Excluded numbers are removed from the grid before drawing.

If repeats are allowed, the chance that k draws from N values contain at least one repeat is 1 โˆ’ (1 โˆ’ 1/N)(1 โˆ’ 2/N)โ€ฆ(1 โˆ’ (k โˆ’ 1)/N). This is the birthday problem. With 23 draws from 365 values the chance is about 50.7%.

Frequently asked questions

How does a random number generator work?

A random number generator produces numbers that follow no pattern you can predict. Most software uses a pseudo-random number generator, which is a formula that turns an internal starting value (the seed) into a long sequence that looks random. This tool offers two sources: the standard Math.random generator and the browser's secure generator, crypto.getRandomValues, which is seeded from unpredictable system entropy.

What is the difference between ordinary and cryptographically secure randomness?

Both are pseudo-random, but they have different goals. An ordinary generator such as Math.random is designed to be fast and statistically well spread, and its output may be predictable if someone learns its internal state. A cryptographically secure generator is designed so that nobody can predict the next value, or recover earlier ones, from the values they have seen. Use secure randomness for passwords, tokens, keys and fair draws, and either source for games and casual sampling.

Which source should I choose?

Choose Secure when fairness or unpredictability matters, for example a giveaway, a raffle, a security-related value or a draw that people will dispute. Choose Standard for casual uses such as picking a number to play a game or sampling for a quick test. For anything that guards something valuable, such as a password or an encryption key, use a dedicated password manager or cryptographic library rather than a web calculator.

Are the numbers truly random?

Computers are deterministic, so software generators are pseudo-random rather than truly random. Truly random numbers come from physical processes such as electrical noise or radioactive decay. The secure source in this tool is seeded with system entropy and is suitable for most uses, but this page cannot prove the quality of your device's generator.

Is the generator fair? Does every number have the same chance?

Yes. Every possible value has the same probability. The tool uses rejection sampling to avoid modulo bias, which is a subtle error that makes some numbers slightly more likely when a range does not divide evenly into the generator's output. Both endpoints of your range are included, so 1 to 6 can return 1, 2, 3, 4, 5 or 6.

What does the 'no duplicates' option do?

It draws numbers without replacement, like pulling numbered tickets from a hat and not putting them back. Each number can appear only once. You cannot request more unique numbers than the range holds, so 11 unique numbers from 1 to 10 is reported as an error.

Why do I get repeated numbers when duplicates are allowed?

Because each draw is independent. Repeats are more common than most people expect. The tool shows the chance of at least one repeat for your settings. For example, drawing 10 numbers from 1 to 100 has about a 37% chance of at least one repeat. This is the same effect as the birthday problem, where just 23 people give about a 50% chance that two share a birthday.

What does shuffle a sequence do?

It returns every whole number from the minimum to the maximum exactly once, in a random order. It is useful for randomizing a list, assigning turns or creating a random order of items numbered 1 to N. The tool uses a Fisher-Yates style shuffle, which gives every possible ordering the same chance.

Can I generate decimal numbers?

Yes. Choose Decimals and set the number of decimal places, from 1 to 10. The tool picks uniformly from every value on that grid, from the minimum to the maximum inclusive. For example, 0 to 1 with 2 decimal places has 101 possible values: 0.00, 0.01, up to 1.00.

Can I use negative numbers or exclude certain numbers?

Yes. The minimum and maximum can be negative, for example -50 to 50. You can also exclude numbers, separated by commas or spaces, so they are never drawn. This is useful for skipping numbers you have already used or numbers you want to avoid.

How many numbers can I generate at once?

Up to 10,000 numbers in one go. The first 300 are shown on the page and you can reveal the rest, copy them, or download them as a TXT or CSV file. A shuffle can contain up to 10,000 numbers.

Can I use this to pick lottery numbers?

You can generate numbers that fit a lottery format, for example six unique numbers from 1 to 49 sorted from smallest to largest. Every combination has the same chance, which for 6 of 49 is 1 in 13,983,816. No generator, including this one, can improve your odds, and past results do not influence future draws.

What is the gambler's fallacy?

It is the mistaken belief that past random results change the next one, such as thinking a coin is 'due' for heads after several tails. Each independent draw has the same probability regardless of history. A fair coin has a 50% chance of heads on every flip.

Is it safe to use for passwords or encryption keys?

No. Do not use a web page to create passwords or keys. Use a trusted password manager or a cryptographic library, where the output is generated and stored securely and is not shown on a page, copied to history or kept in browser memory.

Are my numbers saved or sent anywhere?

No. The numbers are generated in your browser. The history list lives only in the page and disappears when you leave. The page link stores your settings, such as the range and quantity, but never the results.

Can I save or export the results?

Yes. Use Copy numbers to copy them with new lines, commas or spaces between them, or download a TXT file or a CSV file that includes the position of each number.

Understand your result

Random Number Generator guide

A random number generator looks simple, but the details decide whether the numbers are fair, whether repeats are possible and whether anyone could predict them. This guide explains what the settings mean and how to choose them for common jobs.

Ordinary versus cryptographically secure randomness

Almost all software random numbers are pseudo-random, produced by a formula from an internal state. An ordinary generator such as JavaScript's Math.random aims for speed and an even spread. Its algorithm is not specified for security, so if an attacker could learn its internal state, later values could be predicted.

A cryptographically secure generator, such as the browser's crypto.getRandomValues, is built so that its output cannot be predicted from previous output, and it draws on unpredictable system entropy. It is slightly slower, but fast enough for any use on this page. Choose secure randomness for fair draws, and standard randomness for games and casual picks. For passwords and keys, use a password manager or a vetted cryptographic library.

Repeats, unique numbers and shuffling

With repeats allowed, each draw is independent, like rolling a die many times. The same number can appear more than once, and it does more often than people expect. Ten numbers between 1 and 100 contain a repeat about 37% of the time.

With no duplicates, the tool draws without replacement, like drawing numbered tickets from a hat. This suits raffles, lottery-style picks and selecting a random sample. A shuffle is the special case where you take every number from the minimum to the maximum once, in random order, which is a quick way to randomize a list.

Probability basics for random numbers

For a fair generator over a range of N values, every value has a probability of 1 in N. A roll from 1 to 6 gives each face a 1 in 6 (16.7%) chance, a coin flip from 0 to 1 gives 50% each, and a number from 1 to 100 gives 1% each. The chance of a value not appearing in k independent draws is (1 โˆ’ 1/N)^k.

Past results do not change the next draw. A random sequence can include streaks and clusters, and that is normal. Believing that a number is due because it has not appeared is the gambler's fallacy.

Choosing settings for common jobs

To pick winners for a giveaway, number the entries from 1 to N, set the quantity to the number of winners, turn on no duplicates and use the secure source. To roll dice, use 1 to 6 with the quantity set to the number of dice and duplicates allowed. For a coin flip, use 0 and 1.

To create test data, use decimals with the precision you need. To assign an order, shuffle 1 to N. To avoid a number, add it to the exclude list. Remember that the tool cannot improve your odds in games of chance, and that it is not intended for generating passwords or encryption keys.

Continue with a related calculation

References and further reading

Quick reference: Chance of at least one repeat (the birthday problem)

Worked example: the chance that at least two of n independent random draws match when each draw has 365 equally likely values. The same formula is used by the generator to show the chance of a repeat for your own range.

Chance of at least one repeat (the birthday problem)
Number of drawsChance of a repeatMeaning
1011.69%About 1 in 9
2041.14%Close to 2 in 5
2350.73%The classic birthday result
3070.63%Likely
4089.12%Very likely
5097.04%Almost certain
7099.92%Nearly certain

Read the complete Random Number Generator guide

See the longer walkthrough and reference notes for Random Number Generator.

Open Guide

Author & Formula Review

Author

Jitendra Kumar

Founder & Lead Developer

Reviewed by

OmniCalc Editorial Review

Formula QA, source review, and calculator maintenance

Last reviewed

Math & Geometry calculator

Formulas, rounding behavior, and worked examples are checked against hand calculations and calculator QA scenarios before publishing.

Primary Sources

Results are general-purpose estimates. Verify critical figures against official sources or a qualified professional. See our sources and methodology and editorial policy.

Explore more calculators