Often I need a random number (as a seed for a split, or to randomly order records). Now you might think that, if we have a randomnumber generator, you could make things MORE random if you multiply these (random * random is randomer). Let's see if this holds true by just trying!
Say we have 20,000 random numbers between 0 and 1 we can plot the number against their frequency using a histogram (100 bins):
Now this looks pretty random, 100 bins means that the space is divided in 100 sections. So 1 bin (section) with all values between 0.00 - 0.01 , 1 bin with all values between 0.01-0.02.
We observe that most bins have a value between 0.009 & 0.011 and all between 0.008 & 0.012. which means that there are about 0.010 * 20,000 = +/- 200 points generated with a value between 0 and 0.01.
There are also 200 point generated with a value between 0.01 and 0.02 and so on. This indeed looks rather random. We can also plot the index (1st number
generated to 20,000th number generated) versus the value:
Again this looks al pretty random, and so it should. The whole space is filled evenly.
Now here comes the kicker: If we multiply these random numbers (the same in the same order) with another random number things start to look less random:
Again we can plot the index versus the number:
What we see is that the numbers are actually getting less random. So a given value occurs more frequently. Now let's look at the bin plot again:
Remember just now, there were approximately 200 points with a value between 0.00 and 0.01. Now we see 0.06 * 20,000 = 1200, conversely we see only 0.00005 * 20,000 = 1 datapoint with a value between 0.99 and 1.00! This is looking much less random.
And this effects gets worse when we use 3 times random numbers multiplied:
0.165 * 20,000 = 3310 values between 0.00 - 0.01 and 0 values between 0.99 - 1.00. The highest bin is between 0.89 and 0.90 with 0.0001 * 20,000 = 2 data points.
And 4 times random numbers multiplied…
0.33030 * 20,000 = 6606 values between 0.00 and 0.01 & again 0 in the highest bin. There is 0.00005 * 20,000 = 1 datapoint with a value between 0.86 and 0.87. (perhaps not very visible in the second plot)
So there you have it, while you might think that random *
random is more random than random, it is NOT! This is stated by the central
limit theorem. In probability theory, the central limit theorem (CLT) states
that, given certain conditions, the arithmetic mean of a sufficiently large
number of iterates of independent random variables, each with a well-defined
expected value and well-defined variance (all will be between 0 and 1), will be
approximately normally distributed, regardless of the underlying distribution. (see [1] http://www.math.uah.edu/stat/sample/CLT.html, [2] Rice, John (1995), Mathematical Statistics and Data Analysis (Second ed.), Duxbury Press, ISBN 0-534-20934-3), also [3] wikipedia, https://en.wikipedia.org/wiki/Central_limit_theorem )








