【发布时间】:2019-02-20 04:06:25
【问题描述】:
std::sample()的输出序列是否遵循输入序列的顺序?
例如,
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);
是否保证output 永远不可能成为[1, 2, 3]?
【问题讨论】:
标签: c++ algorithm random c++17