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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

We get gcd§216 256¨ ¥ 1,815225. <strong>Test</strong>s <strong>for</strong> Studying <strong>Random</strong> Data5.14. gcd test (greatest common divisor)This test calculates <strong>the</strong> greatest common divisor of two random numbers using Euclid’salgorithm. Now <strong>the</strong> number of steps to complete Euclid’s algorithm and <strong>the</strong> resulting gcdwhere checked against <strong>the</strong>ir expected probability.The idea of this test is described in [20] and some <strong>the</strong>ory may be found in [16] in section4.5.2, in <strong>the</strong> exercises and in <strong>the</strong> accordingly answers.The problem is that <strong>the</strong> expected distribution of <strong>the</strong> number of steps and <strong>the</strong> gcd is unknown,so <strong>the</strong> comparison must be done with simulated values.Example:We calculate <strong>the</strong> gcd of 216 u¥and 256 v¥The algorithms gives:25621640¥16¥¥ ¥4040¤16216¤8816¤and <strong>the</strong> number of steps 4 k¥5.15. Gorilla testThis is a strong version of <strong>the</strong> monkey test from <strong>the</strong> Diehard test suite [17] . The test counts<strong>the</strong> number of missing 26-bit “words” and compares it with <strong>the</strong> expected value. Un<strong>for</strong>tunatelyMarsaglia’s version is hard-wired so a more flexible implementation has to develop<strong>the</strong> associated statistic. The <strong>the</strong>ory of <strong>the</strong> test and its implementation can be found in [20]5.16. Ising-model testThe Ising model [15] is one of <strong>the</strong> simplest and most fundamental models of statistical mechanics.It describes <strong>the</strong> properties resulting from interacting spins on a lattice.The system considered is an array of N fixed points called lattice sites that <strong>for</strong>m an n-dimensional periodic lattice. Associated with each lattice site is a spin variable s1 which is a ei<strong>the</strong>r¤number or that is 1 1. If s 1, <strong>the</strong> ith site is said to havespin up, and if s it is said to have spin down. A given set of numbers s i specifies aconfiguration of <strong>the</strong> whole system. The energy of <strong>the</strong> system in <strong>the</strong> configuration specifiedby si§i¥i is defined by <strong>the</strong> Hamiltonian¤ i¥ N¨ ¢¡¢¡¢¡ i¥∑ ¢ i j£s i s jJwhere J is <strong>the</strong> coupling energy. The sum is over pairs of nearest-neighbour sites on <strong>the</strong>lattice. H¥36

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

Saved successfully!

Ooh no, something went wrong!