c++11 - What is the difference between shuffle and random_shuffle c++ -
the function std::shuffle has been introduced in c++11:
template< class randomit, class urng > void shuffle( randomit first, randomit last, urng&& g );
and has same signature 1 of overloads of std::random_shuffle introduced in c++11:
template< class randomit, class randomfunc > void random_shuffle( randomit first, randomit last, randomfunc&& r );
the difference in third parameter where:
urng must meet requirements of uniformrandomnumbergenerator
is all? difference shuffle
performs compile time check? behavior otherwise same?
if read documentation @ cppreference.com closely, find randomfunc
passed random_shuffle
has different interface. invoked r(n)
. existed before c++11.
std::shuffle
uses standardized way of getting random numbers , invokes g()
. standardized random number generators introduced c++11 std::shuffle
.
Comments
Post a Comment