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.

4. Using <strong>the</strong> “<strong>Random</strong> <strong>Number</strong> <strong>Generator</strong> <strong>Test</strong> <strong>Suite</strong>”built. This is done by masking <strong>the</strong> bit representation of <strong>the</strong> number with a specific maskwhich is shift from <strong>the</strong> least significant bit to <strong>the</strong> most significant bit. An example of splittingup a number in overlapping sub-numbers is given in figure 4.1. This class is calledoriginal = 180Bits 3..0 = 4Bits 4..1 = 10Bits 5..2 = 13Bits 6..3 = 6Bits 7..4 = 111 0 1 1 0 1 0 001 00 11 0 11 1 0 11 1 01 1000Figure 4.1.: Bit <strong>Test</strong>, Example of Bit Concatenationrng_bit_test and is located in <strong>the</strong> same denominated header file. This wrapper canonly be used if <strong>the</strong> test is derived from one of <strong>the</strong> given base classes (chisquare_test,ks_test or gaussian_test). The interface istemplaterng_bit_test(TEST test) type of <strong>the</strong> test number of bits <strong>for</strong> each random numbertest test to use <strong>for</strong> bit testExampleAs an example we want to know if a sequence of each 10 bits is uni<strong>for</strong>mly distributed in aχ 2 sense. We have to create a test object, pass this to <strong>the</strong> wrapper an register <strong>the</strong> test.chisqr_uni<strong>for</strong>mity_test chi_uni_test(200000, 10);rng_bit_test bit_chi_uni_test(chi_uni_test);rng<strong>Test</strong>.register_test(bit_chi_uni_test);4.7. Bit extract testAno<strong>the</strong>r way to test a generator is to extract only a specific range of bits from each generatedrandom number and interpret this bits as a new number. In figure 4.2 bits 2¡¢¡¢¡5 are used tomake a new number. Or, we take a specific bit of a number of random numbers and interpretthis bits as a new number. In figure 4.3 this is done with bit 5. To build a new random numberbit five of six consecutive random numbers are used.This tests are supported by two wrappers in rng_bit_extract.h.templatebit_extract(std::size_t b=10240) type of random number generator16

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

Saved successfully!

Ooh no, something went wrong!