How to properly seed a mersenne twister RNG?

后端 未结 1 1036
南方客
南方客 2020-12-31 06:45

This is actually not as simple as I first thought.

In the absence of a hardware RNG, what is the best way to seed a Mersenne Twister?

Or should I say, what i

1条回答
  •  南方客
    南方客 (楼主)
    2020-12-31 07:01

    There is a nice discussion of pseudo-random number generators here including a section on the proper seeding of PRNGs (see rule 3), which uses md5sum and /dev/random or /dev/urandom to generate seeds.

    This also includes a number of PRNG alogrithms which are a lot easier to code up (< 10 lines of code) than the MT but are arguably just as good (long periods and pass all of the Dieharder tests for randomness).

    Further Reading:

    1. Seed std::mt19937 from std::random_device
    2. Best way to seed mt19937_64 for Monte Carlo simulations
    3. How to obtain (almost) unique system identifier in a cross platform way?

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