Testing the generation of a sequence of zeros and ones

35 Views Asked by At

I am given a sequence of $40$ ones and zeros, and I have to test whether the sequence is random (in the problem this is said to be equivalent to testing the null hypothesis that all ${40 \choose n_1}$ possible sequences are equally probable, $n_1$ being the number of ones). To do so, I have to use the number of times that 1 became 0 and vice versa and then apply normal approximation.

What I did so far is define $Z:=1_{X_j \neq X_{j+1}}$ and then the number of 0-1 and 1-0 changes is $I:= \sum_{j=1}^{n-1}Z_j$ (which is binomial); I then calculated its expectation (following this similar Stackexchange question). From here on, I am stuck. What does it mean to use $I$ to show that "${40 \choose n_1}$ sequences are all equally probable"? How do I exactly use $I$ and normal approximation to test randomness?