Can a Computer Generate a Truly Random Numbers?
How a Computer Can Produce a Truly Random Number
Although one day this may change, computer software alone currently can only generate pseudo-random numbers based on programmed algorithms. Even though these algorithms can produce numbers that are as good as random for almost all purposes, they aren’t truly random.
To generate a truly random number, a computer has to use hardware to observe a natural random event (like atmospheric noise) and then create a random number from that data.
Some will argue this process isn’t “truly random,” but it is close enough to consider the idea that a computer can produce a truly random number a fact. It is just important that we understand the nuance. The nuance being that the computer is essentially borrowing the randomness from nature and then using a deterministic algorithm to create further randomization (which some would consider, “not truly random”).
TIP: This argument assumes that anything in the universe is actually random, and specifically that what a computer observes to create a Random Number Generator (RNG) is random. If the natural random event isn’t actually random, then the random number produced from it via an RNG isn’t truly random either.
A video discussing “what is random“?
FACT: Some argue that neither computers or humans can be random, and that both are deterministic machines. In both cases, the argument is that humans and computers lack the ability to be truly random due to their hard wiring and programming (a human, like a computer, can only draw from what it knows, and thus it is to an extent predictable). One can argue that nature isn’t deterministic at a quantum level however. And, 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 (the logic above assumes nature can be random).
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.
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.
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.
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?
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.
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.