I am trying to pipe a stream of random numbers generated by the Blum Blum Shub PRNG into the Dieharder randomness tests with the command
python generator.py | dieharder -a -g 200
if generator.py is the script containing the BBS pseudo random number generator. If f is the BBS pseudo random generator, and currx is the next value generated by the generator, I am piping a continuous stream of random numbers into Dieharder with the following (updating currx at every iteration).
while True:
currx = f(currx)
sys.stdout.buffer.write(struct.pack('>I', currx))
Where currx is an int. Presently, the generator completely fails every randomness test:
test_name |ntup| tsamples |psamples| p-value |Assessment
#====================================================================#
diehard_birthdays| 0| 100| 100|0.00000000| FAILED
which doesn't make sense because Blum Blum Shub is very good, and when I pass it through different random number testers like ENT it passes all the tests perfectly. This likely means I am piping the data into Dieharder incorrectly. Can anyone help me identify what may be wrong with my code?
The Dieharder manual gives
Raw binary input reads 32 bit increments of the specified data stream. stdin_input_raw accepts a pipe from a raw binary stream.
however from what I can tell my implementation satisfies this. Where am I wrong?
Aucun commentaire:
Enregistrer un commentaire