std::normal_distribution results in wrong order windows versus linux?

前端 未结 1 682
自闭症患者
自闭症患者 2021-01-13 09:47

Anyone came access this issue? Per 1 the implementations are not required to produce same data. What about in practice - are there many differences in STL implementations am

1条回答
  •  广开言路
    2021-01-13 09:59

    Several common methods of generating normally distributed random numbers, such as the Box-Muller transform and the Marsaglia polar method, generate two random numbers at once. A distribution object using one of those methods would generate two random numbers, return one of them, and save the other one for the next time it's called.

    Which one is returned and which one is stored is, of course, completely up to the library author. It looks like libstdc++ and MSVC use the same algorithm, but happen to choose differently.

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