rstub · GitHub

added 4 commits

April 11, 2018 13:37
* Use the full 64 bits of the counter
* Separate counter and key/seed
* Check for carry when increasing counter (only Threefry)
* Use the full 64 bits of the counter
* Separate counter and key/seed
* Check for carry when increasing counter
* Use unused counter values for second threefry round
* Use the full 64 bits of the counter
* Separate counter and key/seed
* Check for carry when increasing counter
This test repeatedly draws 2^20 random numbers and compares them to the
first set of numbers. This fails if a RNG has a period of n * 2^20 with
integer n <= 2^12, i.e. in particular 2^32.
This test repeatedly draws random numbers and generates a histogram from
them. It calculates the chi^2 statistic for the individual step as well
as for the accumulated random numbers. The test fails if two consecutive
statistics are too large or too small. Too large means that the random
numbers are not uniform enough. Too small means that they are "too
uniform", since some amount of random noise is expected.
Additional notes:
* One should also test randn, but that would increase the run-time even
  more.
* The failure conditions are fragile. In principle one should accept a
  larger range of chi^2 values together with more steps, possibly with
  different initial seeds. But this would increase run-time even more.
* As a consequence of the fragile conditions, false positives can occur.
  For example, MERSENNE with double on CPU failed early in some tests.

@rstub

umar456

@umar456

syurkevi pushed a commit to syurkevi/arrayfire that referenced this pull request

Jul 26, 2018
* Improve counter handling for CBRNGs (CPU backend)
* Use the full 64 bits of the counter
* Separate counter and key/seed
* Check for carry when increasing counter (only Threefry)
* Improve counter handling for CBRNGs (OpenCL backend)
* Use the full 64 bits of the counter
* Separate counter and key/seed
* Check for carry when increasing counter
* Use unused counter values for second threefry round
* Improve counter handling for CBRNGs (CUDA backend)
* Use the full 64 bits of the counter
* Separate counter and key/seed
* Check for carry when increasing counter
* Add (disabled) Test for RNG period
This test repeatedly draws 2^20 random numbers and compares them to the
first set of numbers. This fails if a RNG has a period of n * 2^20 with
integer n <= 2^12, i.e. in particular 2^32.
* Add (disabled) test for RNG quality
This test repeatedly draws random numbers and generates a histogram from
them. It calculates the chi^2 statistic for the individual step as well
as for the accumulated random numbers. The test fails if two consecutive
statistics are too large or too small. Too large means that the random
numbers are not uniform enough. Too small means that they are "too
uniform", since some amount of random noise is expected.
Additional notes:
* One should also test randn, but that would increase the run-time even
  more.
* The failure conditions are fragile. In principle one should accept a
  larger range of chi^2 values together with more steps, possibly with
  different initial seeds. But this would increase run-time even more.
* As a consequence of the fragile conditions, false positives can occur.
  For example, MERSENNE with double on CPU failed early in some tests.
* Add program to test RNGs with PractRand

Read the original on github.com ↗