## Can a Computer Generate a Truly Random Numbers?

In the purest sense, computers can’t generate truly random numbers; they generate pseudo-random numbers based on a programmed algorithm instead. Although computers can’t produce random numbers, we can measure natural random events with machines and get true random values (assuming anything in the universe is actually random).

A video discussing “what is random“?

**FACT**: Neither computers or humans can be random, we are both deterministic machines. In both cases, this is because of our hard wiring and programming. One can argue that nature isn’t deterministic at a quantum level; this is why we measure random events like atomic decay to get random “seed” numbers.

## Random Numbers Simplified

In it’s simplest form:

- Random means unpredictable or determinable (non-deterministic).
- Non-random means predictable or not determinable (deterministic).

Everything that computers or humans do is predictable to some extent, so neither can produce truly random numbers (they produce pseudo or “fake” random numbers instead). To get truly random numbers, we have to look to nature and hope nature doesn’t have a bias.

Although we aren’t sure that anything in the universe is truly random, scientists agree that when it comes to fluctuations of the smallest particles (like the movement of quarks, radioactive decay, or atomic noise) randomness occurs. We can measure the randomness of tiny natural events and get a random “seed” number. But the second we apply a computer algorithm to the seed, or get too involved as humans, we all but remove the true randomness from the result.

Randomness is important in everything from the lottery to security software, but in a practical sense a pseudo random number, with a truly random seed, typically gets the job done (sometimes even better than a truly random number). From here the discussion on determinism and randomness gets more philosophical and technical.

## Determinism and “Deterministic” Machines

Computers and humans are “deterministic“, meaning that their outputs are predetermined by some set of existing values and thus predictable to some extent.

If a Random Number Generator is deterministic, it implies that a generated sequence of numbers can be reproduced at a later date if the starting point in the sequence is known.^{[2]}

Computers use code to run programs, and that means the outcome is programmed to some extent and determined by a set of starting values (the algorithm of the code). Humans, in a more philosophical sense, are the same way as our behavior is usually predictable. We can refer to anything that is deterministic as a deterministic machine.

**FUN FACT**: According to “the infinite monkey theorem”, given enough time, a monkey punching random letters on a keyboard would eventually type all of Shakespeare’s plays. Monkeys (like humans and computers) are “deterministic” and thus wouldn’t technically type truly random letters, but for the purpose of argument, one might say they could. If they were truly random, any given monkey might type Edward Albee’s plays instead.

## Non-Deterministic Machines

Although a deterministic machine like a computer can’t produce a truly random number, non-deterministic machines can.

A non-deterministic machine can measure something that is thought to be truly random, like radioactive decay, and produce a random value based on that natural process. We don’t know if anything in the universe is, in fact, random, or to what extent the measuring process effects randomness. We think that machines (not computer software) can produce truly random numbers by measuring random natural occurrences on the atomic or quantum level (the smaller, the better).

A video on “True Random Number Generators“.

## Hybrid Machines Aren’t Random Either

The problem with true random number generation comes when we consider the uses to which we plan to put the random numbers. Most of the time we want results to be unique or have some other property (we don’t want results to repeat, or we want numbers in a certain range), but truly random numbers have a rule set governing them. To get a very random, but still useful number, we have to use a deterministic pseudo random number generator that uses the non-deterministic machine’s value as a starting point or “seed”.

“True Random Number Generators” that “harvest” randomness from the environment for a random starting value still aren’t truly random in the purest sense as they still rely on computers and humans to process the starting value.^{[1]}^{[3]}

If a human or computer builds the measurement tool and observes the measurement, it calls into question the role of the observer or the entity that measures the randomness of an event. Even if a human or computer isn’t involved in the process of getting a number, some argue that the random physical phenomenon of providing the “seed” may not be truly random. For instance, atomic noise may not be truly random. Although we have a heck of a time proving randomness as fact; It’s easier to prove non-randomness.

**FACT**: Minuscule things like quarks and photons change based on our observation, at least as far as we can tell with our tools of measurement. This makes it even harder to be sure that we have removed human determinism from the randomness of natural events.

Philosophical arguments aside, for practical purposes, the argument isn’t as much about the randomness of the physical phenomenon is it is about the processing of that phenomenon. As soon as a human or a computer is involved in the process the number necessarily loses its randomness.

**FACT**: Even when number generation is based on physical phenomena expected to be random, such as atmospheric noise, thermal noise, and other external electromagnetic and quantum phenomena, arguments can be made against it being truly “random”. Is anything truly random? Does observation affect results?^{[3]}

## Pseudo Random Numbers Versus Random Numbers

In simple terms, random numbers can’t be predicted, and pseudo-random numbers can be predicted by “backwards engineering”. (Backwards engineering = predicting a result by figuring out the algorithm used to create the result.)

- Pseudo-random numbers are numbers that are essentially random but are generated using a computer algorithm. Since a human always programs an algorithm, it’s never truly random and resists backwards engineering.
- Random numbers are numbers that are truly random and cannot be backwards engineered.

**FACT**: RNG stands for Random Number Generator, and PRNG stands for Pseudo-Random Number Generator. Typically, since all RNGs are PRNGs, RNG is used as an acronym for all random number generators.

A video describing the difference between Random and Pseudo-Random.

## “Truly” Random Numbers and Computers

Some say a computer can never give a truly random result in the purest sense. Others (like Random.org) argue that HRNGs, (True Random Number Generators) have been alive and well since at least 1998.^{[2]}

### Basing Random Number Generators on Natural Unpredictable Processes

The key to what some claim as “true” computer-based random number generation is using physical phenomena like atmospheric noise, which is itself expected to be random, as a starting point and then compensating for possible biases in the measurement process.

Even though this method comes close to producing a truly random number (close enough to base lotteries and slot machines on it) to a purest, human and computer involvement in the process means the number isn’t truly random.

**FACT**: Random.org uses atmospheric noise for its RNG.

## There is No Pure Computer Based True Random Number Generator

Today’s “true RNGs” come extremely close to producing truly random numbers, but the experts don’t agree that the results are truly random in the purest sense of the word. Also, they are only loosely computer based as the random values are obtained with hardware rather than software.