Pseudo-random number generator

前端 未结 10 734
无人及你
无人及你 2020-12-09 05:17

What is the best way to create the best pseudo-random number generator? (any language works)

相关标签:
10条回答
  • 2020-12-09 05:25

    See Pitfalls in Random Number Generation

    0 讨论(0)
  • 2020-12-09 05:27

    My favorites are Hardware random number generators

    0 讨论(0)
  • 2020-12-09 05:33

    If you're going to work in C++, Boost has a collection of PRNGs that I'd trust a lot more than whatever comes in standard libraries. The documentation might be helpful in picking one out. As always, how good a PRNG is depends on what you're using it for.

    0 讨论(0)
  • 2020-12-09 05:36

    Best way to create one is to not to.

    Pseudo-random number generators are a very complex subject, so it's better off to use the implementations produced by the people that have a good understanding of the subject.

    0 讨论(0)
  • 2020-12-09 05:37

    The German magazine C't tested a number of software and hardware generators in the 2/2009 issue and ran the results through various statistical tests.

    I scanned the results here.

    I would not bother writing my own. The article mentions that even Donald Knuth failed with his "Super-random number generator", which was not so random after all. Get one that passed all tests (had a result > 0 in all columns). They also tested a setup with a VIA EPIA M10000 mobo, which has a hardware RNG. I like this option for a commercial or semi-commercial setup that requires a robust random number server with high throughput.

    Unless, of course, you are just playing around, in which case this may be good enough.

    0 讨论(0)
  • 2020-12-09 05:38

    See this link for the TestU01 suite of tests, which includes several batteries of tests.

    http://www.iro.umontreal.ca/~simardr/testu01/tu01.html

    In the paper, the author demonstrates the test result on a variety of existing RNGs, but not .NET System.Random (as far as I can tell). Though he does test VB6's generator.

    Very few pass all the tests...

    0 讨论(0)
提交回复
热议问题