Does the C++11 standard guarantee identical random numbers for the same seed across implementations?

后端 未结 1 1696
悲&欢浪女
悲&欢浪女 2021-02-12 09:53

For example if I instantiate a std::mt19937 with the exact same seed and parameters under GCC and under MSVC, should I get the same sequence of random numbers? If s

相关标签:
1条回答
  • 2021-02-12 10:19

    For the new random number engines, yes, for the same seed and parameters you'll get the same sequence of values on all platforms. For rand(), no. You also don't have that guarantee with random number distributions, even when they are fed the same sequence of input values.

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