3

I have been wondering what would be the advantage of using mt19937_64 (for instance in boost, or c++11) over its 32 bit variant?

Thanks.

user119690
  • 31
  • 2

1 Answers1

3

It has a larger seed, allowing for more distinct pseudorandom sequences. Essentially this means you can put more randomness in. It produces 64-bit numbers, so you get more pseudorandomness out at a time. And, it is implemented using 64-bit operations, so it will perhaps go faster on a 64-bit machine and slower on a 32-bit machine.

Both contain the same amount of total state, 64 × 312 = 19968 bits, so the sequences are equally predictable in that sense. If you want more state, you can parameterize it yourself using std::mersenne_twister_engine.

Potatoswatter
  • 134,909
  • 25
  • 265
  • 421
  • Another difference is that when you generate double numbers between 0 and 1 you will fill all 53 bits, not just 32. Not sure where it could possibly matter, but it's nice to know. – loreb Mar 23 '14 at 13:23