如何测试随机数? [英] How to test random numbers?

查看:93
本文介绍了如何测试随机数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用matlab编写了一个程序,该程序可以生成0到1之间的随机数.我仅用matlab中的runstest对其进行了测试,结果是该序列是随机的.我也看到了直方图,并且它们具有beta分布.我想通过其他测试来测试此rng,例如diehard,ent或nist,但我不知道如何进行.有人可以解释如何使用它们,或建议我进行其他一些随机性测试.谢谢

解决方案

对于大多数测试,您可以提供一个较大的随机数文件(整数或浮点数),并对该示例文件运行各种测试.如果我没记错的话,DIEHARD就是这样工作的,其他人也是如此.如果您确实希望生成器发生故障,则可以尝试使用 TestU01 由Pierre L'Ecuyer进行,它具有足够的测试,可以让几乎每个发电机都至少通过一项测试:-)

仍然,对于大多数测试套件来说,都有大量的文档,至少对于 DIEHARD ,来自 NIST SP 800-22 以及 DieHarder TestU01 (链接指向文档).通常,提供随机数以进行测试的方法有所不同,但在相应的文档中都有提及.

i have written in matlab, a program, which is supossed to generate random numbers between 0 and 1. i have test it only with the runstest in matlab, and te result is that the sequence is random. i have seen the histograms too, and they have a beta distribution. i want to test this rng whith other test, such as diehard, ent, or nist, but i don't know how. can someone explain how to use them, or suggest me some other randomness tests. thank you

解决方案

With most tests you can supply a large file of random numbers (integer or floating point) and run various tests on that sample file. DIEHARD worked that way, if I remember correctly and some others do, too. If you really want to see your generator fail, you could try using TestU01 by Pierre L'Ecuyer which has enough tests in it to let nearly every generator fail at least one test :-)

Still, for most test suites there is extensive documentation, at least I know this for DIEHARD, the test suite from NIST SP 800-22 as well as DieHarder and TestU01 (links go to the docs). The methods for supplying random numbers to test are usually different but mentioned in the respective documentation.

这篇关于如何测试随机数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆