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.

ii¨3. Analyzing Statistics3.2. Kolmogorov-Smirnov test (KS test)As we have seen, <strong>the</strong> χ 2 test be applied when observations can fall into a finite number ofcategories. But normally one will consider random quantities which may assume an infinitenumber of values. In this test, <strong>the</strong> random number generators distribution function F iscompared to <strong>the</strong> expected distribution function F§x¨. In [16], Knuth defined this functionsas follows:n§x¨F§x¨ ¥ probabilityF n§x¨that§X of X 1 X 2 ¢¡¢¡¢¡£ x¨nn which are xXThe n measured random values must be sorted in ascending order, X 1 X 2 ¡¢¡¢¡n¥numberTo make <strong>the</strong> test, we <strong>for</strong>m <strong>the</strong> following statistics:K¡n ¥n max£ ∞¤ x¤ ∞§F ¢ n§x¨F§x¨¢¨ ¥¥¢ n max1¤ i¤ nK £ n ¥n max£ ∞¤ x¤ ¢ F∞§F§x¨n§x¨¢¨¢ n max1¤ i¤ n¥F§X i¨1n iXn F§XLike in <strong>the</strong> χ 2 -test, we may now look up <strong>the</strong> values K¡n , K £ n in a table [16] to determineif <strong>the</strong>y are significantly high or low. An o<strong>the</strong>r way is to calculate <strong>the</strong> probabilities by<strong>the</strong> algorithm given in [1] and in chapter 3.3.1, “C. History, bibliography, and <strong>the</strong>ory”of [16]In [16] <strong>the</strong>re is also <strong>for</strong>mula given to calculate <strong>the</strong> probability exactlyprob§K¦ntttnn∑ nk©0k ¥ n¨¢§k t¨k§t¤ n k¨n£ k£ 1(3.2)Example: 10 random numbersWe got 10 numbers from a random number generator. These are {0.809, 0.465, 0.151, 0.628,0.318, 0.824, 0.394, 0.968, 0.179, 0.458}First we sort <strong>the</strong> random numbers X i ascending orderCalculate <strong>the</strong> K¡ quantities i and K i£and find <strong>the</strong> maximum of <strong>the</strong>se quantities6

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

Saved successfully!

Ooh no, something went wrong!