Randomness testing using frequency within a block method, chi-square statistic doubt.

#1
The chi-squared statistic under the frequency within a block method is defined as 4M summation of (proportion of 1s in block - 0.5 ) ^2
where M is the length Of each block
I understand that this follows a chi-square goodness of fit test observed-expected frequency square. But where does this 4M come from ?

Thank you.
 
Last edited: