# Random Number Generator

Created by Rita Rain
Reviewed by Bogna Szyk and Jack Bowater
Last updated: Jan 18, 2024

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, click the arrow below the "Result" field. (Make sure the "autosave" option is turned on by clicking the floppy disk icon next to the "Minimum value" and "Maximum value" fields).

By default, minimum and maximum values are included in the range of numbers generated. If you want to exclude them, click "advanced mode" (below the "Result" field), and you'll see the option to exclude one or both.

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

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.

In the advanced mode, 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 with the same settings again, click the "autosave" option to the right of the variables you want to stay the same.

## 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:

• a random number list generator (random number table generator)

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

• a 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.

• a random 4-digit number generator

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

• a random number sequence generator

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

• a random number generator no repeats

If you generate multiple numbers and want no repeats, go to advanced mode and set "no" in the "allow duplicates" section.

• to pick a random number between 69 and 666

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

• to choose a random number between 1 and 4

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

• to generate 5 random numbers

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

• to 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 a 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)

## FAQ

### 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). PRNG are often used in computer games while TRNG 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 to generate a new phone number?

To generate a new phone number:

1. In the random number generator, choose the adequate number of digits for a phone number of your desired country (7 digits for 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 to 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.

Rita Rain
Generate
one number
Minimum value
Maximum value
Result
People also viewed…

### Black hole collision

The Black Hole Collision Calculator lets you see the effects of a black hole collision, as well as revealing some of the mysteries of black holes, come on in and enjoy!

### Circle skirt

Circle skirt calculator makes sewing circle skirts a breeze.

### Polynomial regression

The polynomial regression calculator can help you find a polynomial curve that best fits your data set.