umontreal-simul / TestU01-2009

This is the 2009 version of TestU01, a software library, implemented in the ANSI C language, and offering a collection of utilities for the empirical statistical testing of uniform random number generators.
Apache License 2.0
64 stars 17 forks source link

False positive in sstring_HammingWeight2 (also fails with Boring SSL's secure RNG) #6

Closed jlebar closed 3 years ago

jlebar commented 3 years ago

Similar to https://github.com/umontreal-simul/TestU01-2009/issues/5, I've found that sstring_HammingWeight2 fails with Boring SSL's secure RNG (in addition to the insecure RNG I was testing).

sstring_HammingWeight2 test:
-----------------------------------------------
   N = 100,  n = 100000000,  r =  0,   s = 30,   L = 1000000

-----------------------------------------------

Kolmogorov-Smirnov+ statistic = D+    :   0.000
p-value of test                       : 1 - eps1    *****

Kolmogorov-Smirnov- statistic = D-    :    1.00
p-value of test                       :   eps      *****

Anderson-Darling statistic = A2       : 3573.68
p-value of test                       :   eps      *****

Test on the sum of all N observations
Number of degrees of freedom          : 10000
Chi-square statistic                  :1.14e+10
p-value of test                       :   eps      *****

-----------------------------------------------

RNG implementation:

#include "boringssl/rand.h"
...
uint64 r;
(void)RAND_bytes(reinterpret_cast<unsigned char*>(&r), sizeof(r));
return r;
jlebar commented 3 years ago

Dupe of https://github.com/umontreal-simul/TestU01-2009/issues/5#issuecomment-728371051