# Random Number Generator ðŸŽ²

Use this random generator to get a truly random, cryptographically safe number. It generates random numbers that can be used where unbiased randomization is needed such as when drawing numbers for a lottery, raffle, giveaway, or sweepstake. An RNG draw can also be used for determining who goes first in a game, and so on.

*Quick navigation:*

- How to pick a random number between two numbers?
- Where are random numbers useful?
- Generating a random number
- True random versus pseudo random number generators

* * How to pick a random number between two numbers?

You can use this random number generator to pick a truly random number between any two numbers. For example, to get a **random number between 1 and 10**, including 10, enter 1 in the first field and 10 in the second, then press "Get Random Number". Our randomizer will pick a number from 1 through 10 at random. To generate a random number between 1 and 100, do the same, but with 100 in the second field of the picker.

To **simulate a dice roll**, the range should be 1 to 6 for a standard six-sided dice. To perform the equivalent of a **coin flip**, set the range between 1 and 2 and the random selector will pick a number between 1 and 2.

To generate more than one unique number (meaning there are no repeats), just select how many you need from the drop-down below. For example, selecting to draw 6 numbers out of the set of 1 to 49 possible would be equivalent to simulating a lottery draw for a game with these parameters.

* * Where are random numbers useful?

You might be organizing a charity lottery, a giveaway, a raffle, a sweepstakes, etc. and you need to draw a winner - this generator is for you! It is **completely unbiased and outside of your control**, so you can assure your crowd of the fairness of the draw, which might not be true if you are using standard methods like rolling a dice. If you need to choose several among the participants instead, just select the number of unique numbers you want generated by our random number picker and you are all set. However, it is usually best to draw the winners one after another, to keep the tension for longer (discarding repeat draws as you go).

A random number generator is also useful if you need to decide **who goes first** in some game or activity, such as board games, sport games and sports competitions. The same is true if you need to decide the **participation order** for multiple players / participants. Picking a team at random or randomizing a list of participants also depends on randomness.

Nowadays, a number of government-run and private lotteries and lottery games are using software RNGs to pick a number instead of more traditional drawing methods. RNGs are also used to determine the outcomes of all modern slot machines. For some other modern applications, see How Random Numbers Are the Driving Force Behind Video Games, Jury Selection, and More.

Finally, random numbers are also useful in statistics and simulations. In statistical applications one often needs to draw numbers randomly from distributions different than the uniform, e.g. a normal distribution, binomial distribution, power distribution, pareto distribution... For such use-cases a more sophisticated software is required to perform the draw.

* * Generating a random number

There is a philosophical question about **what exactly "random" is**, but its defining characteristic is surely **unpredictability**. We cannot talk about the unpredictability of a single number, since that number is just what it is, but we can talk about the unpredictability of a series of numbers (number sequence). If a sequence of numbers is random, then you should not be able to predict the next number in the sequence while knowing any part of the sequence so far. Examples for this are found in rolling a fair dice, spinning a well-balanced roulette wheel, drawing balls from a sphere, and the classic **flip of a coin**. No matter how many dice rolls, coin flips, roulette spins or lottery draws you observe, you do not improve your chances of guessing the next number in the sequence. For those interested in physics the classic example of random movement is the Browning motion of gas or fluid particles.

Given the above and knowing that computers are fully deterministic, meaning that their output is completely determined by their input, one might say that we cannot generate a random number with a computer. However, one will only partially be correct, since a dice roll or a coin flip is also deterministic, if you know the state of the system.

The randomness in our number generator comes from physical processes - our server gathers environmental noise from device drivers and other sources into an **entropy pool**, from which random numbers are created ^{[1]}.

### Sources of randomness

According to Alzhrani & Aljaedi ^{[2]} there are four sources of randomness that are used in the seeding of a generator of random numbers, two of which are used in our number picker:

- Entropy from the disk when the drivers call it - gathering seek time of block layer request events.
- Interrupt events from USB and other device drivers
- System values such as MAC addresses, serial numbers and Real Time Clock - used only to initialize the input pool, mostly on embedded systems.
- Entropy from input hardware - mouse and keyboard actions (not used)

This puts the RNG we use in this randomizer in compliance with the recommendations of RFC 4086 on randomness required for security ^{[3]}.

* * True random versus pseudo random number generators

A **pseudo-random number generator (PRNG)** is a finite state machine with an initial value called the **seed** ^{[4]}. Upon each request to draw a number at random, a transaction function computes the next internal state and an output function produces the actual number based on the state. A PRNG deterministically produces a periodic sequence of values that depends only on the initial seed given. An example would be a linear congruential generator like PM88. Thus, knowing even a short sequence of generated values it is possible to figure out the seed that was used and thus - know the next value.

A **cryptographic pseudo-random number generator (CPRNG)** is a PRNG in that it is predictable if the internal state is known. However, assuming the generator was seeded with sufficient entropy and the algorithms have the needed properties, such generators will not quickly reveal significant amounts of their internal state, meaning that you would need a huge amount of output before you can mount a successful attack on them. Randomizers of this type are suitable if the number drawing generator is to be used in a high stakes situation.

A hardware RNG is based on an unpredictable physical phenomenon, referred to as **"entropy source"**. Radioactive decay, or more precisely the points in time at which a radioactive source decays is a phenomenon as close to randomness as we know, while decaying particles are easy to detect. Another example is heat variation - some Intel CPUs have a detector for thermal noise in the silicon of the chip that outputs random numbers.

Hardware RNGs are, however, often biased and, more importantly, limited in their capacity to generate sufficient entropy in practical spans of time, due to the low variability of the natural phenomenon sampled. Thus, another type of RNG is needed for practical applications: a **true random number generator** (TRNG). In it cascades of hardware RNGs (entropy harvester) are used to periodically reseed a PRNG. When the entropy is sufficient, it behaves as a TRNG. This is the type of process used to generate random numbers in this tool.

* * References

1 Linux manual page on "urandom"

2 Alzhrani K., Aljaedi A. (2015) "Windows and Linux Random Number Generation Process: A Comparative Analysis", *International Journal of Computer Applications* 113:21

3 Schiller J., Crocker S. (2005) "IETF RFC 4086 - Randomness Requirements for Security"

4 Goichon F., Lauradoux C., Salagnac G., Vuillemin T. (2012) "A study of entropy transfers in the Linux Random Number Generator", research report 8060

#### Cite this calculator & page

If you'd like to cite this online calculator resource and information as provided on the page, you can use the following citation:

Georgiev G.Z., *"Random Number Generator"*, [online] Available at: https://www.gigacalculator.com/calculators/random-number-generator.php URL [Accessed Date: 06 Jun, 2023].