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.

5. <strong>Test</strong>s <strong>for</strong> Studying <strong>Random</strong> Databirthday birthdays sorted spacings spacings sorted305 71143 101 30 5285 122 21 6290 132 10 10331 143 11 1171 173 30 13122 186 13 15279 201 15 15101 228 27 15201 279 51 21173 285 6 26228 290 5 27132 305 15 30186 331 26 30346 346 15 51The collisions of “birthday spacings” are printed bold. We got three collisions.The mean of <strong>the</strong> Poisson distribution is µ¥3 15 34 365¥ 2¡3124n¥Constructor in birthday_spacing_test.hmbirthday_spacing_test(std::size_t runs,std::size_t birthdays,uint64_t days,std::size_t maxCollisions)runs number of birthday experiments to runbirthdays number of birthdays in a yeardays number of days in a yearmaxCollisions collision counts above this number are cumulated5.9. Collision test (Hash test)The χ 2 test statistic is meaningful only when each interval has more than, lets say, 5 samples.But this test is designed such that <strong>the</strong> number of intervals is much larger than <strong>the</strong> number ofsamples.Suppose we throw n balls randomly into m empty urns with m n. If a ball falls intoa nonempty urn we get a collision. This is <strong>the</strong> 1-dimensional collision test. To get <strong>the</strong>¡2-dimensional version, we have to sort <strong>the</strong> urns on a 2-dimensional array.Sometime this test is also called “Hash test”. The test can be interpreted as building anenormous hash table and generating an appropriate index. Some <strong>the</strong>ory can be found in [16]or in [4]Select <strong>the</strong> number of “balls” n and <strong>the</strong> number of “urns” m. To do this make a listBALLS[n] and insert <strong>for</strong> ball i <strong>the</strong> urn in which it falls.32

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

Saved successfully!

Ooh no, something went wrong!