A Random Post

If you were to flip a fair coin, we know that there is a 50% chance of getting a heads.  The coin makes a seemingly random decision, that is hardly game-able or predictable.  In contrast when we want to flip a coin in software, we run into a problem: computers work deterministically. Often we want to use a weighted software coin for random sampling, generating initial conditions for models, or cryptography.  There is nothing random about software; underlying each line of code is a set of machine instructions that are carried out in the hardware of the computer.  The code is literally a mathematical function; it takes some input and produces some output.  To develop true randomness we must have an equation which takes in the same input but produces different output.  It's as if you have an equation such as x+5=9 and you receive different results every time you solve it; it's not possible.

If a function's output is always the same given an input, how can we simulate randomness?  The answer is to use an input source unbeknownst to the coin flipper.  You could use the computer's clock, phase of the moon, or even a lava lamp.  As long as the consumer of the random number is not aware of the input, it cannot predict the result of the coin flip.

It's not until we attempt to simulate randomness that we truly understand what it means for something to be random.  What we consider to be random in our everyday life (the cause of all superstition) is no different than this computer generated coin toss.  We believe a real coin to be random because a majority of the input is hidden to us as humans.  However, if we could freeze time while the coin is midair, and measure every possible influence on the result of the coin toss (speed of rotation, velocity, surface friction, wind speed, etc.), then we could predict with 100% certainty the result of the coin toss.  This is the basis of physics: given all input and the equations which act on a system, we can predict the results after some time t.


The coin flip is a small example of how the universe works.  If you could witness the beginning of the universe and measure every minuscule particle while knowing every equation which operates on these particles, without any knowledge of the world to come, you could accurately predict the state of these particles at any point in history: the formation of the planets, the rise and fall of dinosaurs on earth, and the beginning of the human race.  You could even predict your existence and that on this exact second you would be reading this sentence.  It may not be humanly feasible to do so, but that should have no impact on its correctness.  Since everything must follow the laws of physics, everything is deterministic and predictable.  Complex systems which have many layers of abstraction and many input (eg. brain) are no different.  We know that a function is not random unless its inputs are random; therefore if no input can be random, abstractions built using functions of these inputs cannot be random.  In other words, if the sub-systems are deterministic, then the resulting combination of these sub-systems is also deterministic.  There is no more randomness in the weather than there is in the toss of a coin.


It's difficult for us to imagine our brain to work like a deterministic machine.  We like to think that we have free will, that our brain is special and doesn't follow the laws of physics.  "I choose to think what I want to think and I choose to do what I want to do".  Often we build an illusion of control by imagining an abstract layer on our mind.  Who is it that wants these things?  Not a separate person outside the effects of this universe, but a fragment of the mind that is a result of the combination of physical substrate which is governed by determinism.  If you were to rewind time and press play, you would make the exact same decision in exactly the same way you have made previously.  Still think you're not deterministic?  Try playing rock-paper-scissors against this computer.

The lack of randomness of the universe also implies that even if a god existed, he or she could not have any impact on the world after setting up the initial conditions.  Any deviation from the pre-determined course of the universe would introduce randomness or break a law of physics.

One Quantum Problem

Quantum mechanics is obviously worth noting here for its contradiction to classical physics and seemingly inherent randomness. When dealing with systems at the smallest of scales, classical physics fails miserably at being able to definitively predict the future.  Particles at the quantum level appear to be in multiple states simultaneously and suspiciously snap to a single state after being measured.  Unlike the deterministic classical physics, quantum mechanics uses probability distributions to predict with uncertainty the state of a particle after some time period.  There are multiple schools of thought around quantum mechanics leading to various interpretations.

The stochastic school of thought implies that the randomness is inherent in the universe; that dealing with the particles at the quantum level will always be guess work. "Copenhagenism insists that it is a fact of Nature that there will never in the future be discovered a theory that goes beyond the probabilities yielded by the Born Rule"

On the other hand, the deterministic school of thought views quantum physics as an incomplete science.  Essentially, there exists some hidden variable and relationship, which makes it currently impossible for us to accurately predict the state of a particle.  Einstein strongly believed that there is a missing overarching law of physics which unifies both the classic and quantum physics.  "As I have said so many times, God doesn't play dice with the world."