I wanted to code a line that shuffles a vector. Auto completion suggested shuffle_order_engine
, which made me curious what it is, since the name suggests it does what I want.
Usually i shuffle a vector with std::shuffle(std::begin(v), std::end(v), gen)
where gen
is the random number generator (usually mt19937_64
).
http://ift.tt/1OOIlGu sais, that shuffle_order_engine
is:
An engine adaptor class template that adapts a pseudo-random number generator Engine type so that the numbers are delivered in a different sequence.
Well, cplusplus.com does not provide an example. Is shuffle_order_engine
doing the same as my shuffle
adoption?
Aucun commentaire:
Enregistrer un commentaire