Random Numbers are generated by Random Number Generators (RNG). It plays a vital role in today’s world where security and entertainment is an important aspect. This post will discuss what is Random Number Generator (RNG), it’s types, How it works, techniques for generation, architecture, applications, advantages and disadvantages.
What is Random Number Generator (RNG)
RNG is designed to generate Random sequence. To generate Random Numbers it requires input which is an information source with positive entropy. The source of entropy could be atmospheric noise, variations in mouse movements or it may be a radioactive source. It has a memory and generates non-likely random variables. Randomness is an event whose state cannot be predicted easily and accurately. Ideally, RNG, is memory less that outputs unlikely sequence of random variables.
Fig. 1 – Introduction to Random Number Generator
Random Numbers are widely used in various applications like computer programs, cryptography, casino games, mobile applications like music players, digital games like lottery, lotto etc. The development of quantum cryptography and quantum information processing has given a new dimension to the applications using RNG’s. Fig. 2 shows the physical view of RNG. The range of this device as mentioned is 1 to 4 i.e. it allows the selection of 1 to 3 Random Numbers. It displays the numbers generated on LCD and outputs via serial port.
Fig. 2 – Physical View of RNG
Types of Random Number Generators
There are two types of Random Number Generators. They are:
- True Random Number Generators (Non-Deterministic Random Number Generators)
- Pseudo Random Number Generators (Deterministic Random Number Generators)
True Random Number Generators
The numbers generated by this type of device are not predictable by any mathematical logic and and mainly depend on the physical information like atmospheric noise. They are also called as Non-Deterministic Random Numbers generated through hardware.
Pseudo Random Number Generators
The Random Numbers generated by this device is predictable as it uses mathematical algorithms through software. They are also called as Deterministic Random Numbers.
Techniques for Generating Random Numbers
There are three techniques for generating Random Numbers. They are:
- Linear Congruential Method
- Combined Linear Congruential Generators
- Random Number Streams
Linear Congruential Method
These are the most widely used Random Number Generator in use today. This method produces sequence of integers between 0 and m-1 according to the equation:
a = Multiplier
c = Increment
m = modulus
To generate Uniform Random Numbers, we use the equation:
According to Hull-Dobell theorem, Linear Congruential Generator whose cycle length is m, has full period, if the conditions mentioned, holds good. They are:
- If q is a prime number, that divides m, then q divides a-1.
- The only positive integer that divides both m and c is 1.
- If 4 divides m, then it also divides a-1.
Combined Linear Congruential Generator
Some of the application systems require longer period length due to the increase in complexity of the system. Hence two or more multiplicative congruential generators are combined to achieve this.
Let the nth output from k different multiplicative Congruential Generators be Xn1, Xn2, ……. Xnk.
Therefore, Xj is defined as :
Xn+1, j = ( ajXn + cj ) mod mj , Where;
mj = prime modulus
aj = multiplier
c = increment
Random Number Streams
Random Number Stream refers to the starting seed taken from the sequence X0, X1 ……. Xp. and considering ‘b’ values apart and the Stream ‘i’ could be defined by starting seed i.e.
Si = X b(i – 1)
Seed is an integer value that initializes Random Number Sequence for a Generator. If the RNG has k streams, then it acts like k distinct virtual RNG’s.
Architecture of RNG
The system consists of modules namely:
- Sensor Module
- Generation Module
Fig. 3 – Architecture of Random Number Generator
This module is responsible for capturing data. Sensor acquires the data and provides an interface to transfer the collected information to the computer. The sensor converts physical information such as noise (analog) signal to digital signal.
In this module, the process of Post-processing happens where the data is binarized. This data is transferred to output module.
The output module accepts the binary data and stores it as a file. Random Number is generated using this file and is displayed.
How does RNG Work
Let us consider RNG, that uses the randomness of Radioactive decay as an entropy source to generate random numbers. According to Quantum Mechanics, the decay of atoms is random and cannot be predicted. The System has PIC (Programmable Interface Controller) Microcontroller and special type of counter called as Geiger Counter which detects ionizing radiation. Shift Registers are used that act as RAM for the system.
Fig. 4 – Working of RNG
The entropy or the random event acts as input to the system. The counter detects the radiation and is controlled by the Microcontroller. The Microcontroller rotates the numbers inside the Register which is around 10,00,000 numbers per second. When the Microcontroller detects the random event (Radioactive particle), it terminates the rotation of numbers, reads the current number and stores in Shift Register.
Shift Registers act as RAM for the system. The Shift Register accepts the input and shifts for every clock cycle and outputs the data on LCD via serial port. Thus sequence of numbers are generated and these numbers are known as Random Numbers.
Applications of Random Number Generator
The applications include:
- The Random numbers are widely used in Digital games.
- They are also used in Statistical Sampling.
- Used in Cryptography, computations in statistical physics.
- Widely used in casino games like Roulette wheel.
- Also used in Radio communications.
- RNG’s are used for numerical analysis.
Advantages of Random Number Generator
The advantages are:
- RNG’s provide security to diverse systems.
- Pseudo Random Generators are easier to implement.
- Pseudo Random Numbers can be generated faster compared to True Random Numbers.
- Reproduction of the existing sequence is possible if the initial point is known.
Disadvantages of Random Number Generator
The disadvantages are:
- Few Pseudo Random Generators have shorter periods for some Seed values.
- True Random Number Generators are expensive to implement.
- The random numbers generated by Linear Congruential Generator depends on the bit position and lower bits will be less random than the upper bits.