In general, random number generation involves the use of a program or device referred to as a random number generator to generate a set of numbers that lack any discernible pattern and therefore are referred to as “random.” Just how random, and therefore how unpredictable, these random numbers are however, varies greatly from generator to generator.

Uses of random numbers

Humans have relied on randomness for thousands of years. Perhaps the most well known example in history is of Athenian democracy. In the fifth century BC, the legislative bodies of the government of Athens in Ancient Greece were made up of average citizens. Because of the strong support for direct democracy, Athenian citizens were selected at random to make up these bodies. Random selection was also used to select jurors for trials.

In modern times, juries are still selected at random, but the use of random number generation has also spread to countless other fields. In science, random numbers are used to create simulated data for economic models, climate change models, hurricane models, and even epidemiologist models. From simple models predicting the result of a number of coin tosses, to complex models simulating neutron transportation in nuclear fission, random numbers often play an important role.

Of course, random number generation is monumentally important in data security and encryption. Random number generators are used to create encryption keys, salts, and keyfiles for keeping data safely encrypted. If encryption keys are generated using a nonrandom approach, they can be predictable and easily determined, allowing just about anyone with the right expertise to decrypt and access your data.

Random number generation is also needed for lottery management systems and other random drawings. In some cases, unbiased random number generation is required by law, such as in random drug testing.

Reliability of random number generators

In 1969, the United States Selective Services System held a lottery to determine the order at which men would be called to military service in the Vietnam War based on birthdays. Each date from January 1 to December 31 was placed in a capsule, and the capsules were then mixed in a box, placed in a jar, and selected at random in a televised event. The order the dates were selected would be the order of drafting. However, it became apparent after the lottery that many more of the dates from November and December had lower rank numbers than other dates, and indeed, statistical analysis later showed that the results could not have been the result of an actually random process.

This example is relevant to answering the following questions: is a random number generator always as reliable as it seems, and if not, which ones can we trust to produce genuinely random numbers?

Pseudo versus true random number generation

Unfortunately, the previous example shows that random number generators are not always as accurate as they seem. In hindsight, there were important problems with the selection method in the 1969 draft lottery—notably, the capsules may not have been properly mixed in the box before being placed in the jar, leading to an unknown bias in selecting November and December dates.

Similarly, many random number generators used today are not actually random. These generators rely solely on computer algorithms to generate sequences of numbers that appear random and are called pseudorandom number generators (PRNGs). They produce sets of numbers from mathematical formulas that look random, but are actually periodic. If the starting point of a sequence is known, the exact same set of numbers can be generated over and over again. PRNGs are highly efficient, meaning they are able to produce large quantities of numbers quickly, but are by nature periodic and deterministic. Others can recreate the same set of numbers with the right starting information. This makes PRNGs unsuitable generators for many uses, including all types of data security, random sampling, and lotteries.

Other random number generators, known as true random number generators (TRNGs) use physical phenomena to generate sets of numbers. These generators do not rely solely on mathematical formulas. Instead, their source for random numbers can be all sorts of things, such as variations in a user’s mouse movement, atmospheric noise, or even radioactive decay.