Omni Calculator logo
Last updated:

Random Number Generator

New

Table of contents

Pick a number — how to use the random number generatorPossible applications of the random number pickerWhat is RNG, and how do random number generators workTrue random number generators and pseudorandom number generatorsFAQs

This random number generator can produce pseudorandom numbers within a given range. You can pick numbers from -999,999,999,999,999 to 999,999,999,999,999, choose to generate decimals or integers, include or exclude the minimum and maximum values, disallow duplicates (random number generator with no repeats), and sort results from smallest to largest.

It can serve as a single random number picker or a random number list generator. In the text below, you'll find information on how to use this random sequence generator. It will also answer the questions: "What is RNG?", "What is the difference between pseudorandom number generators and true random number generators?" and "How do random number generators work?"

The numbers generated by this lucky number generator are pseudorandom — not truly random, but suitable for most purposes. However, be careful if you want to use it to encrypt top-secret government documents.

Pick a number — how to use the random number generator

  1. Single random number generator

    If you want to generate one random number, choose a number that will be the lower limit (the minimum value), and then pick a number that will be the upper limit (the maximum value). To generate again, press the calculator reload button.

    By default, minimum and maximum values are included in the range of numbers generated, but you can always choose the option that fits you by opening the Generator options section of the calculator.

    You can also generate decimals (up to two decimal places) — to do that, change the "type of number(s)" setting to decimals.

  2. Random number list generator

    If you choose the "multiple numbers" option in the "Generate" field, input how many numbers you need, and you'll see a sequence of random numbers.

    You can also choose whether you want to allow duplicates in the random list and whether you want the results to be sorted (from smallest to largest).

    If you want to generate numbers again with the same settings, press the three dots icon and enable the "Save input value" setting. Saved values have a pin.

Possible applications of the random number picker

Here are some ways you can use the random number generator. It may be helpful if you need the following:

  • Random number list generator (random number table generator)

    Choose the "multiple numbers" option and input how many numbers you need (the list's length).

  • Phone number generator

    Choose the "multiple numbers," enter "7" into the "how many" field (or another adequate number if you're not in the USA), and set the minimum value to 0 and the maximum value to 9. If 0 is the first number of the sequence, try again. The sequence will be a random phone number.

  • Random 4-digit number generator

    Set the minimum value to 1,000 and the maximum value to 9,999.

  • Random number sequence generator

    Works the same as a random list generator; see above.

  • Random number generator with no repeats

    If you generate multiple numbers and want no repeats, unselect the "allow duplicates" checkbox.

  • Pick a random number between 69 and 666

    Set the minimum value to 69 and the maximum value to 666. RNGesus will forgive you. 😈

  • Choose a random number between 1 and 4

    Set the minimum value to 1 and the maximum value to 4.

  • Generate 5 random numbers

    Choose "multiple numbers" in the first field and enter "5" in the "how many" field.

  • Pick a number from 1 to 10

    Set the minimum value to 1 and the maximum value to 10.

What is RNG, and how do random number generators work

RNG (random number generator) is a device that produces a sequence of numbers that can't be predicted (each outcome has the same probability of being chosen).

Rolling dice is a random hardware number-generating method (and our dice probability calculator is its analog version). Each result has the same chance of appearing (P = 1/6). The same goes for flipping a coin — in our coin flip probability calculator, you can calculate the probability of getting heads and figure it's equal to 50%, and so is the probability of getting tails (not including the possibility of it landing on its side). If you're curious enough, you can try flipping a coin 100 times to check that the longer you flip, the closer you get to an even distribution of outcomes. This phenomenon is known as the law of large numbers.

Although rolling dice is fun, using software is much quicker and more convenient. But how can computers produce random results if they're entirely deterministic? All that computers do is follow instructions, so how can anything they do be random?

True random number generators and pseudorandom number generators

One solution is relying on some external input, which is truly random. For example, computers can use data from a piece of hardware that measures a random physical phenomenon like background radiation. These types of devices are called true random number generators.

Another way is to produce an outcome that seems unpredictable but, in fact, is the result of a strictly defined mathematical process.

Software that does this is called a pseudorandom number generator. It takes in a "random enough" number (a seed), e.g., a part of the current time in the system's clock, and performs a function on it. The result is a pseudorandom number.

For many purposes (like gameplay or graphics), pseudorandom generators are enough, but true random number generators are needed, especially for encryption.

This number generator is pseudorandom and uses the JavaScript function Math.random(). The algorithm which produces the result depends on the web browser you use. Nowadays, most browsers use the xorshift128+ algorithm, which is based on bitwise operations, which are manipulation of data at the level (learn what a bit is in our byte conversion tool)

FAQs

What does RNG mean?

RNG stands for random number generator. It is an algorithm that produces a sequence of numbers that can't be predicted, so each outcome has the same probability of being chosen.

We distinguish between true random number generators (TRNG) and pseudorandom number generators (PRGN). PRNGs are often used in computer games, while TRNGs are used for encryption.

How do random number generators work?

There are two main principles to generate random numbers:

  • True random number generator algorithms take the current value of a physical environmental attribute that is constantly changing in a way that is practically impossible to model.
  • Pseudorandom number generator algorithms reproduce numbers by taking a seed as an input and performing a precisely defined algorithm on it.

What is a pseudorandom number?

A pseudorandom number is an outcome that seems unpredictable but, in fact, is the result of a strictly defined mathematical process. The algorithms of pseudorandom number generators (PRGN) take a seed to create random numbers. They are used widely in simulations, computer programming, and as long as the seed stays a secret, also in cryptography.

How do I generate a new phone number?

To generate a new phone number:

  1. In the random number generator, choose the number of digits that correspond to the phone number of your desired country (7 digits for the USA).
  2. Set the minimum value to 0 and the maximum value to 9.
  3. If 0 is the first number of the sequence, let the generator run again.
  4. The resulting sequence will be a random phone number.

How do I generate a random number in Python?

There are many ways to generate a pseudorandom number or sequence in Python. Here are some useful ones:

  • random.randint(a, b) generates random integers;
  • random.random(a, b) generates floating point numbers; and
  • random.sample(a, b, length_of_list) generates sequences of random numbers.

Consult Python's documentation for more functions in the random module.

Beware: Python uses the Mersenne Twister algorithm as its default PRNG. It is completely unsuitable for cryptographic purposes because its seeds are predictable.

Check out 34 similar probability theory and odds calculators 🎲
AccuracyBayes theoremBertrand's box paradox...31 more