forked from arrayfire/arrayfire
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve counter handling for CBRNGs (arrayfire#2122)
* 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
- Loading branch information
Showing
7 changed files
with
211 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.