Random number generator *(RNG)* — it is a system designed to generate a sequence of numbers or symbols
whose meaning cannot be predicted in advance. A specific sequence of generated results may contain a certain
pattern that will be traced after the generation process, but which could not be foreseen in advance.

## Hardware random number generator

To generate true random numbers, a hardware random number generator *(HRNG)* is used
or it is also called true random number generator *(TRNG)* —
is a device that generates random numbers from a physical process that is constantly changing in a manner that is
practically impossible to model. Such generators can be based on the use of macroscopic random processes, that is
on a scale that allows measurements and observations with the naked eye, for example, coin flipping, dice or
roulette wheels. Although a macroscopic process can be fully determined according to Newtonian mechanics,
a well-designed mechanism such as a roulette wheel will produce an unpredictable result, which can be explained
by chaos theory and the instability of dynamical systems due to the difference in the initial conditions of each
new attempt to spin the roulette wheel. The main disadvantage of generators using macroscopic processes has always
been slow speed, and as a result, the inability to generate a large number of values in a short period of time.

Today, hardware random number generators tend to use devices based on microscopic phenomena that generate low-level, statistically random "noise" signals, such as various "noise" signals (shot, thermal, atmospheric), the photoelectric effect, involving a beam splitter, and other quantum phenomena. Such processes are good sources of entropy because their result is absolutely impossible to predict in theory, but due to the complexity of implementation and relative slowness of work, the scope of use of such generators is limited to subject areas with certain requirements for the generated values.

Basically, electronic hardware random number generators are used in cryptography to generate random cryptographiclly keys to ensure secure data transfer, for example, in Internet encryption protocols such as Transport Layer Security protocol*(TLS)*.

## Pseudorandom number generator

An alternative to hardware (physical) generators are generators based on algorithms — pseudo-random number generators *(PRNG)*,
that create a sequence of numbers that looks like random, but in fact it is not. The numbers generated by the PRNG
cannot be considered truly random as they completely determined by an initial value, called the PRNG's seed. Although
the sequence of numbers generated by hardware random number generators is closer to truly random, pseudorandom
number generators are often used in practice in many areas due to their speed in number generation, ease of
implementation and relative cheapness. There are many methods of creating pseudorandom sequence of numbers,
among them the Mersenne Twister, a linear congruential generator (LCG), Xorshift random number generators, also
called shift-register generators, the Well Equidistributed Long-period Linear (WELL) which is a form of
linear-feedback shift register optimized for software implementation and other methods based on algorithms.
### Mersenne Twister

The Mersenne Twister is one of the most popular pseudorandom number generators developed in 1997 by
Makoto Matsumoto (松本 眞) and Takuji Nishimura (西村 拓士). Its name comes from the fact that its
period length is chosen as a Mersenne prime, it is a prime number of the form for some integer n.
This PRNG was designed specifically to solve most of the shortcomings found in previous PRNGs. The main advantages of the Mersenne Twister:
### PRNG with entropy source

Along with the need to quickly generate easily reproducible sequences of random numbers, there is also a need
to generate completely unpredictable or simply completely random numbers. In order to satisfy both conditions,
combinations of a crypto-resistant PRNG and an external source of entropy are most often used and it is these
combinations of generators that are now commonly called random number generator *(RNG)*. Such generators are most
often used for generation unique symmetric and asymmetric keys for encryption, gaming industry and other areas.
An example of the operation of a combined generator is as follows: a physical device, using a reliable source
of entropy (such as thermal noise), generates the "seed" for a faster cryptographically secure
pseudorandom number generator, which then generates a pseudorandom output sequence at a much higher data rate.

Today, hardware random number generators tend to use devices based on microscopic phenomena that generate low-level, statistically random "noise" signals, such as various "noise" signals (shot, thermal, atmospheric), the photoelectric effect, involving a beam splitter, and other quantum phenomena. Such processes are good sources of entropy because their result is absolutely impossible to predict in theory, but due to the complexity of implementation and relative slowness of work, the scope of use of such generators is limited to subject areas with certain requirements for the generated values.

Basically, electronic hardware random number generators are used in cryptography to generate random cryptographiclly keys to ensure secure data transfer, for example, in Internet encryption protocols such as Transport Layer Security protocol

- A very long period of 2
^{19937}— 1 - Passes many statistical randomness tests, including Diehard tests and most, but not all of the TestU01 tests
- Has a permissive free software license and patent-free for all variants except CryptMT
- k-distributed to 32-bit accuracy for every 1 ≤ k ≤ 623
- Implementations generally generate random numbers faster than true (hardware) generation methods

© 2021-2023 RandNumberGenerator.com