我试图通过命令将Blum-Blum-Shub-PRNG生成的随机数流导入Dieharder随机性测试
python generator.py | dieharder -a -g 200
ifgenerator.py
是包含BBS伪随机数生成器的脚本。如果f
是BBS伪随机生成器,而currx
是生成器生成的下一个值,我将通过以下方法将连续的随机数流传送到Diehard(在每次迭代时更新currx
)
while True:
currx = f(currx)
sys.stdout.buffer.write(struct.pack('>I', currx))
其中currx
是int
。目前,发电机完全无法通过所有随机性测试:
test_name |ntup| tsamples |psamples| p-value |Assessment
#====================================================================#
diehard_birthdays| 0| 100| 100|0.00000000| FAILED
这是没有意义的,因为Blum-Blum-Shub非常好,当我通过不同的随机数测试,比如ENT,它会完美地通过所有测试。这可能意味着我正在错误地将数据传输到Diehard中。有人能帮我找出我的代码有什么问题吗
迪哈德手册给出了
Raw binary input reads 32 bit increments of the specified data stream. stdin_input_raw accepts a pipe from a raw binary stream.
然而,从我所能说的,我的实现满足了这一点。我错在哪里
目前没有回答
相关问题 更多 >
编程相关推荐