# Testing sequence of ones and zeros for randomness

I am given a sequence of $$40$$ ones and zeros and I have to test the null hypothesis that $${40 \choose n_1}$$ sequences are all 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. 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"?

• This makes little sense and doesn't appear to be testable from just one sequence. Plotting the random walk given by $I$ can be helpful. See the closely related thread at stats.stackexchange.com/questions/574333 for illustrations and more ideas.
– whuber
May 12 at 19:04