What is Random?
When you think about Randomness, what comes to mind? Coin flips, slot machines, most of the topics I bring up in conversation…these are just some examples. The umbrella definition of random is ““. This simply means that there is no way to discern an outcome based on any logic, reason or pattern. These are easy to create in the real world, flipping a coin or rolling dice are both physical methods of obtaining a random number with no way to predict the outcome outside of cheating, therefore, this produces what is known as a True Random Number. In fact, True Random Numbers can only be created in the physical world. Now, this approach is practical when we are talking about games of chance like roulette or craps, where we can wait for the physical determiner (dice, ball) to pick a random number and make us lose all of our money, but when we talk about something more complicated like generating a unique randomized temporary password, or calculating whether a legendary item will drop in a video game, physical randomization is too slow and impractical. When quick computation and processing is a requirement, another technique is used utilized what is known as Pseudo-Random Numbers.
Pseudo-Random Numbers, as the name implies, are not actually completely random, they follow a specific predetermined pattern. Now, don’t run off to the slot machines yet…Pseudo-Random Numbers, while predetermined, are still outside calculation capability by any human. There are many methods used for Pseudo-Random Number calculation, but the most commonly used is called ‘Linear Congruential Generator’. This function in its most basic form looks like this:
seed = (a * seed + c) % modulus
Where the seed is an initial value, and ‘a’ and ‘c’ are predetermined modifiers. This equation essentially begins with an initial seed value, transforms it into a new number, and then iterates forward creating new numbers from each previous seed. This creates an infinitely long pattern of numbers, that could be precalculated if you were given the initial seed, ‘a’ and ‘c’ values. While this method is not as unpredictable as True Random Numbers, it is far more efficient and quick to produce numbers for calculation. Now, the outstanding question is “how is a random initial seed calculated if the random itself depends on the seed?”. Because, as I stated before, True Random Numbers only exist in the physical word, the seed is calculated using a complicated process called ‘Entropy’. Entropy is a very large topic on its own, but in the simplest form it is a way that a computer gathers random data using various physical hardware (i.e. the noise a system’s fan generates).
Other Cool Random Number Generators
When security if of the upmost importance, you cannot take the chance that a Pseudo-Random number sequence could be compromised. This has led to creative approaches to generating True Random Numbers. One method is listen to the noise generated from lightning storms and to digitize it’s values into random numbers. This method works great, but is reliable on weather patterns. Another method is to use a radioactive source, and measure the time between radioactive decay, but this method can be quite costly and is primarily used in expensive laboratories. By far, the most creative method I’ve come across is at Cloudfare, Inc. in San Francisco. Cloudfare Inc. is a security firm protects roughly 10% of the internet, and to make sure their encryption methods are unpredictable, they generate random numbers by reading data off of 100 lava lamps located in their lobby. Their “Wall of Entropy” as they call it, is photographed every millisecond of every day, and the pixels of the photograph are then turned into numeric values. This is just one of many creative ways of digitizing the randomness of the natural world.