It is obviously not random because it is a concatenation of predetermined bit sequences. Therefore, we must check that the same groups of bits are not repeated too often.
We can use the frequency of "words" to determine if certain bit groups occur too often. There are four possible 2-bit words: 00, 01, 10, and 11. If we assign A, B, C, and D to these words, respectively, then the sequence above transforms into the following sequence.
s=BBBBADADABDBBBBADADABDAADD
Now we can run a frequency test on this string with four categories.
The p-value for a chi-squared of 9.0769 with 3 degrees of freedom is 0.0000, which is less than 0.01, indicating that this sequence of numbers was probably not randomly generated.
This test, known as the word frequency test, is a significantly more difficult to pass than the runs test. Instead of concatenating predetermined strings, we must use a mathematical process that has seemingly random behavior. One very simple off-the-shelf method for doing this is using a linear congruential generator, which is defined by the following formula.
Xn+1=(aXn+c)modm
In this formula, Xn is the current value in the sequence, a is the multiplier, c is the increment, and m is the modulus. X0 is a seed that can be arbitrarily chosen. The word frequency test fails to detect output from a linear congruential generator.
Linear Congruential Generator0011011100101101101110110101110100101010101101101011010010101111101111100101100010001011100111000000
Notes
The word frequency test can give very different results depending on the block size chosen. Larger block sizes don't always result in smaller p-values.
Word Frequency Test (Block Size = 2)01010101001100110001110101010100110011000111000011110101010100110011000111010101010011001100011100001111
Word Frequency Test (Block Size = 3)01010101001100110001110101010100110011000111000011110101010100110011000111010101010011001100011100001111
Word Frequency Test (Block Size = 4)01010101001100110001110101010100110011000111000011110101010100110011000111010101010011001100011100001111