We consider a vector u
, realisation of i.i.d. uniform random
variables \(U_1, \dots, U_n\).
The frequency test works on a serie seq
of ordered contiguous integers
(\(s_1,\dots,s_d\)), where \(s_j\in Z\!\!Z\). From the
sample u
, we compute observed integers as
$$d_i = \lfloor u_i * ( s_d + 1 ) + s_1 \rfloor,
$$
(i.e. \(d_i\) are uniformely distributed in
\(\{s_1,\dots,s_d\}\)). The expected number of integers equals to
\(j\) is \(m= \frac{1}{s_d - s_1+1}\times n\). Finally, the
chi-squared statistic is
$$ S = \sum_{j=1}^d \frac{(card(d_i=s_j) - m)^2}{m}.
$$