What is a Random Number Generator?

Tech info | January 11, 2022

Random number generator (RNG) is a device, software or combination of both intended to produce a sequence of chaotic numbers or symbols that are of a good chance, completely unpredictable. Based on different physical phenomena and mathematical algorithms, a given RNG produces continuous sequences of 0's and 1's. Depending on purposes and demands, these binary sequences can be transformed into different format numbers and used in many areas, including scientific research, math, computer science, economics, gambling and lotteries, cryptography, digital security and many more.

Pseudorandom number generators

Pseudorandom number generators (PRNG) are computer algorithms that produce long sequences of random-looking numbers. Because computers in their nature are deterministic machines, although very fast, the numbers generated only by the software are predictable and cannot be used in applications with critical demands on randomness and unpredictability, such as security and cryptography. Using enough computational power, which is not a problem for modern computers at all, ciphers and keys generated by these algorithms can be easily broken. However, for some tasks related to research and statistical analysis, these pseudorandom sequences can be well applicable. One advantage of these generators is their easy implementation and very high operational speed because they are purely software generated.

Uniformly distributed pseudorandom numbers.
Computer-generated pseudorandom numbers with uniform statistical distribution.

Cryptographically secure pseudorandom number generators

Some of the PRNGs use specially designed software algorithms that possess a sufficient degree of resistance against potential hacker attacks and are known as Cryptographically secure pseudorandom number generators (CSPRNG). Although their high degree of security is claimed to allow them to be used in cryptography, their practical applicability is highly questionable. There is also a hybrid approach, where a number produced by a hardware RNG is used to set the starting point of the algorithm, the so-called seed value. The common feature of all these kinds of architectures is that they are PRNGs in essence and therefore inherit all of the PRNG’s security drawbacks.

MCU-embeded random number generators

Today, many MCU manufacturers offer models with embedded RNG modules. The internal architecture they are using, in most cases, comprises several ring oscillators connected in a cascade and generating at the output a series of random bits. Their speed is very high. For example, a 32-bit processor is able to give a 32-bit random number to every CPU clock. Because the ring oscillator is a device composed of an odd number of NOT gates connected in a ring, its output oscillates between two voltage levels, representing 0's and 1's. An important observation is that oscillating frequency tends to be relatively stable and predictable. Small variations in its magnitude, known as jitter, are used as a source of entropy. However, this entropy is not always enough to ensure the desired level of randomness and unpredictability. Thus, even if we consider that these RNGs are indeed hardware-implemented, their use in tasks with high-security requirements is questionable.

Hardware random number generators

GTR-01 – quantum hardware random number generator.
Hardware random number generator.

As the name says, true random number generators (TRNG) or hardware random number generators (HRNG) utilize some physical process as a source of primary entropy. These devices are based on some microscopic phenomena generating low-level, statistically random noise, which is detected, amplified and digitized by an electronic circuit. In their nature, these phenomena can be related to classical physics, such as thermal noise in resistors, atmospheric noise in radio receivers, frequency variations in the clock oscillator and many more. They also can be quantum physics phenomena too, such as radioactive nuclear decay, avalanche noise in a reverse-biased p-n junction, shot noise, photons traveling through a beam splitter and so on. These stochastic processes, in theory, are completely unpredictable. Thus, the TRNGs are the only choice in the tasks requiring the highest possible degree of randomness and unpredictability, primarily in the cryptography and security key generation and data transferring protocols. Please, read more about our USB quantum random number generator.