Go ahead, think of a number at random, any number, I’ll wait . . . what was your number? If you chose was 67 then that’s kind of eerie, mainly because that was my number, and you should get out of my head. But, regardless of which number you chose one question is paramount, are you sure you chose that number at random? Unless you have mastered Buddhism, and can completely clear your consciousness then odds are something influenced your decision, and that’s a problem.
Right now you might be thinking: “what’s the big deal? Why would it matter if a number is random or not?” Well, randomness can be very important for a lot of reasons. In scienctific testing truly random numbers are used to ensure that samples are not biased, and as checks and balances against outside interferences when determining the independence of scientific results. In business random numbers are used for encrypting data and in simulations. Finally, in everyday life randomness ensures that your VLT machine, videogames and lottery numbers are as much a surprise to you as everyone else.
In the olden days (read pre-Nintendo Entertainment System) random numbers were chosen with a variety of methods, such as with mathematical formulas which use things such as prime numbers and squared results to generate randomness from a starting number. Other non-computer methods of choosing random numbers involves large tables of multi-digit numbers organized into rows and columns would help scientists choose a number at random with the highly scientific “close your eyes and point” method. Lotteries relied on the spectacle of the revolving drum and numbered ping-pong balls. But this is the 21st century, and if it’s worth doing, then it’s worth doing with a computer.
You could be forgiven for thinking that asking a computer to generate a random number would be simple, however, the reality of most things we do with computers is that they rely on being highly ordered and organized — in other words, not random. When a computer starts to do random things, most of us either reinstall the operating system or invite Susan, your friend who knows lots about computers, over for coffee. For this reason, in order to get a computer to generate a random number you either have to dust off the old number table we talked about earlier and ask the computer to close its eyes and pick for you, or you have to rely on some external source of randomness.
Pseudo-random number generators
If you need a few random numbers in a hurry and true randomness isn’t necessary, then a number generated by a pseudo-random number generator (PRNG) might be the way to go. Generated either on the spot by mathematical formulas or with pre-determined tables PRNGs can deliver very good random numbers for simple applications. They are efficient at generating long sequences of random numbers and determinate, meaning that the sequence can be regenerated, assuming you know part of the sequence. Both of these traits can be very useful, however the numbers generated by PRNGs are also periodic, which is not as desirable a trait.
Periodic sequences of numbers eventually repeat, and while modern PRNGs can generate so many unique numbers that periodicity is almost a non-issue, it can lead to problems when large amounts of high-quality random numbers are required. To put this into perspective, would you buy a lottery ticket if you knew that some numbers had a higher chance of being picked than others? I didn’t think so.
PRNGs can also be “tricked” into developing sequences of numbers, which appear random, yet have been subtly influenced by the inputs of the user. An infamous example of a PRNG running amok can be found in Random numbers fall mainly in the planes, an article written by George Marsaglia, which appeared in the Proceedings of the National Academy of the Sciences in September of 1968. In his article Marsaglia points out that when certain numbers are inputted into a random number generating formula called a “multiplicative congruential generator” patterns starts to emerge, indicating that the numbers produced were not, as was assumed, random.
For the second time in this article you might be making a “pthbthhhh” noise, and verbally asking anyone within earshot “so a random number generator gave numbers that weren’t so random, what’s the big deal?” Well truth be told it was a huge deal, as Marsaglia’s discovery called 20 years of scientific progress into question. Without truly random numbers, data sets might not have been blindly tested, and seemingly random phenomenon might not have been as random as was indicated. In short, results might have been tainted.
For this reason PRNGs are not the ideal choice when true randomness is required.
True-random number generators
Unlike their mathematical brethren, true random number generators, or TRNGs, rely on an external source of random data to generate their numbers. The sources can be almost anything, from radioactive decay to atmospheric electromagnetic radiation, or “noise” as used by the random number generator at Random.org. One project, the now defunct lavaland generator, even went so far as to create a generator based on a lava lamp.
The advantage of TRNGs is that the people using the numbers generated by them can have a high amount of confidence that the data is truly random, an advantage when picking lottery numbers or encrypting data. However they can often be slow and non-deterministic, meaning that if you loose the sequence it is gone forever. TRNGs are also much more difficult to design and setup than a PRNG due to the need to collect and interpret data from a natural source.
So next time you get asked to pick a number at random, hopefully you’ll have a newfound respect for what a difficult task this can be, a healthy skepticism of anything claiming to be “random” and an answer to the question “what’s the big deal?”