11.07.2015 Views

A Random Number Generator Test Suite for the C++ ... - ETH Zürich

A Random Number Generator Test Suite for the C++ ... - ETH Zürich

A Random Number Generator Test Suite for the C++ ... - ETH Zürich

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

n3. Analyzing StatisticsIn this section we describe <strong>the</strong> χ 2 test and <strong>the</strong> Kolmogorov-Smirnov test. Both are designedto check if <strong>the</strong> measured distribution is similar to <strong>the</strong> expected distribution. So we cancompare different distributions. Later on we describe <strong>the</strong> gaussian test which is based on <strong>the</strong>gaussian normal distribution.A detailed description <strong>for</strong> <strong>the</strong> outlined <strong>C++</strong> classes can be found in <strong>the</strong> section aboutimplementing additional tests 6.1.3.1. χ 2 test (“Chi-square” test 1 )The χ 2 -<strong>Test</strong> is perhaps <strong>the</strong> best known statistical test. It is based on a comparison between<strong>the</strong> empirical distribution function and <strong>the</strong> <strong>the</strong>oretically expected distribution. The empiricaldistribution is based on <strong>the</strong> results of <strong>the</strong> random process.The n measured random values must be divided in k classes I 1 I 2contain N 1¤ 2¤ k¥ ¢¡¢¡¢¡£values.k . The classesIN N NFor each class, <strong>the</strong> expected number of values must be calculated with <strong>the</strong> expecteddistribution¡¢¡¢¡¤function p i <strong>for</strong> a given p i (p p§i¨) i¥ N¦Considering <strong>the</strong> squares of <strong>the</strong> differences between <strong>the</strong> measured values and <strong>the</strong> expectedvalues gives <strong>the</strong> χ 2 valuei¥ Nkχ ∑i©1§n i 2¥npnp i¥i¨21nk∑i©12 inp i(3.1)With k classes, <strong>the</strong>re are 1 degrees of freedom in <strong>the</strong> χ 2 distribution. Lookingup <strong>for</strong> χ 2 and ν in “χ 2 distribution” tables, which can be found in [16], [3], <strong>the</strong>probability being above or below <strong>the</strong> given χ 2 can be found.k ν¥Calculating <strong>the</strong> probability of a χ 2 value is not such an easy task, but <strong>the</strong>re is analgorithm published by Hill and Pike, which can be used, see [11], [12], [14].Example: Throwing a dieAfter throwing a die 120 times we get <strong>the</strong> following resultsvalue 1 2 3 4 5 6# observed 15 19 22 21 17 261 Sometimes <strong>the</strong> “χ 2 test” stands <strong>for</strong> <strong>the</strong> Equidistribution test.4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!