If you look to the specifications of random shuffle in C++11, there are 3 functions. My question is what is the typical use and advantage of :
template< class RandomIt, class URNG >
void shuffle( RandomIt first, RandomIt last, URNG&& g );
compared to:
template< class RandomIt >
void random_shuffle( RandomIt first, RandomIt last );
I mean, it seems that whatever URNG is (a uniform distribution), the result will be the same (from a statistical point of view). The only point I see, is that std::shuffle
is thead-safe, whereas this overload ofstd::random_shuffle
is not. Could you confirm that ?
EDIT: I thought that URNG should be a uniform distribution but that does not seem to compile. So can someone provide a little example of use of std::shuffle
?