Sunday, 15 January 2012

c++ - Is std::random_shuffle reproducable across different compilers? -



c++ - Is std::random_shuffle reproducable across different compilers? -

i using std::random_shuffle function custom random number generator that, same seed, returns same sequence of random numbers across compilers.

however, i'm concerned std::random_shuffle may not utilize same algorithm between different compilers, , therefore, same seed, result won't same.

can rely on std::random_shuffle producing same output across different compilers same sequence of random numbers provided? if not, alternatives?

not using c++11 or boost.

from reading "25.3.12 random shuffle" in c++11 standard (the 1 have here) conclude strictly spoken guarantee can not made. requirement algorithm "that each possible permutation of elements has equal probability of appearance". not have swap elements front end back, example, , iterators random access iterators other order possible. (that said, i'd surprised if implementation wouldn't go first -> last, it's not guaranteed.)

c++

No comments:

Post a Comment