mardi 19 février 2019

Does the output sequence of `std::sample()` follow the order of the input sequence?

Does the output sequence of std::sample() follow the order of the input sequence?

For example,

const std::vector<int> input{2, 4, 6, 8, 1, 3, 5, 7};
std::vector<int> output;
std::sample(input.begin(), input.end(), std::back_inserter(output), 3, any_urbg);

Is it guaranteed that output would never be possible to be [1, 2, 3]?




Aucun commentaire:

Enregistrer un commentaire