Ever played a board game such as monopoly? The pacing of the game is centred around the dice 🎲, a hardware random number generator. Based on how you release the dice, and non-deterministic1 environmental factors, the dice produces a random number – how far you can travel on the board!
1A deterministic system is a system where no random factor determines the output of the system.
Similarly, much of the devices we interact with today continuously transmit and generate information. This information is often represented as smaller binary numbers, which are then converted into 1s and 0s. Hence, when the patterns of 1s and 0s (which carry information) can no longer be simplified, we say that this string of information is random.
This is known as the entropy of a system, and gave rise to one of the most fundamental theories in Physics — Information Theory.
How do we generate random numbers?
We can generate random numbers through both physical and computational methods.
Physical methods such as measuring rates of radioactive decay, clock drift, or thermal noises are prone to biases in the design of the setups. This makes them more difficult to maintain, especially miniaturised for use in small portable devices.
However, in recent times, prototypes have been small enough that they can be connected via USB protocol to the computer.
These can be bought off the shelf for use for cryptographic purposes, such as generating one-time keys.
This device makes use of the Galois field theory, where random numbers are generated from a finite series of numbers during error checking.
⚠️ Error checking arose due to the need to ensure that errors due to transfers over noisy/unreliable mediums can be detected, or even corrected. In this case, the random number generator (RNG) works by detecting errors that occur when random signals are produced where (very little to no current flows) through a reverse-biased transistor.
On the other hand, computational methods are designed to overcome the limitations of physical ones, such as being much faster, requiring less physical and virtual memory space, to suit various use cases.
It is important to take note that most of the computational methods we use to generate random numbers are actually pseudo-random number generators. This means two things:
- they can be predicted (eg. guessing the random next number given the initial starting seed)
- given enough time, we will be able to see the sequence of “random” numbers repeat themselves
While this may sound like a bad thing, there are actually benefits to these properties. For one, imagine a satellite approximately 42000km above Earth’s equator.
Using the same seed, we can essentially ensure that the systems on Earth and the satellite stay synchronised.
However, real uses of random numbers in applications such as simulations of data (eg. different landscapes for games eg. Minecraft) or cryptographic purposes research on appropriate seeds for a particular algorithm that ensure that we will not reach the end of the “sequence” of random numbers for that particular use case.
Computational Psuedorandom Number Generators can be broadly categorised into uniform and non-uniform generators. We will be exploring the different types of RNGs, and how they are used for sampling data in the chapters ahead!