3 Testing Randomness

There is no easy way to test if a given sequence of numbers is random. Randomness is a complex property which has a large number of different implications. We test sequences to see if they satisfy these conditions. Many, Many tests have been devised and new ones continue to be devised. A commonly used collection of tests devised by George Marasaglia is called the Diehard Battery of Tests. We illustrate the concept of randomness tests by providing a few examples of how randomness can be tested.

No Memory Property. Consider a sequence of 0's and 1's that we observe is the real world. We want to know if it could be the outcome of a Bernoulli sequence of random variables. One property of a Bernoulli sequence is that the next outcome does not depend on the previous one. Consider for example the sequence 001111100011000011111000000111111. This sequence does not look random because the number of alternations between 0 and 1 is too small. It seems that the sequence is "sticky": Once a 0 occurs, 0 is more likely to occur next. Similarly, once a 1 occurs, 1 is more like to occur next. To test this property, we COUNT the number of 0's which occur AFTER 0 [11] , and also count the number of 0's which occur AFTER 1.[3]. The difference is rather large, and shows that 0 is more likely to occur after 0. Similarly, we can count the number of 1's which occurs after 1 [14], and the number of 1's which occurs after 0 [4]. Again the difference is rather large. If the sequence was a Bernoulli sequence, than the two numbers should be similar (but not the same). It is possible to do a statistical test, to check if the discrepancy is "significant" and not due purely to chance fluctuations in random sequences. .

There are many other properties; for example, we could test the proportions of 1's and 0's to match the probability of the Bernoulli. If the probability is not known, than we could split the sequence in half and test to see that the proportion of 1's is roughly the same in the two halves. Randomness has a huge number of implications for behavior, and for each implication, we can devise a test to see if a real world sequence of numbers has that property of random numbers

According to our probabilty concept, probability is a metaphor -- this means that it is NEVER true for real world sequences. This means that for any given sequence of numbers in the real world, there will exist SOME test for randomness which the sequence fails. For example, random numbers are unpredictable. However, according to Islamic concepts, the future has already been written down in a book, so that the angels who have access to this book can predict the future. This automatically implies failure of predictability, though it would be difficult to devise a test on this basis.

Given that all real world sequences will fail SOME test for randomness, the point is not to have a complete set of tests for all possible implications of randomness. The point is to have tests which are suitable for relevant applications. Each real world applications requires some small number of properties of randomness. Real world sequences should be tested for those properties which are required by the application -- these properties will be different for different applications.