13 extern std::mt19937_64 rng;
16 template<
typename T> T& random_pick(std::vector<T>& container) {
17 if (!container.size())
18 throw std::runtime_error(
"No candidates available");
20 std::uniform_int_distribution<int> pick(0, container.size()-1);
21 return container[pick(smith::rng)];
25 I random_pick(I beg, I end) {
27 throw std::runtime_error(
"No candidates available");
29 std::uniform_int_distribution<> pick(0, std::distance(beg, end) - 1);
30 std::advance(beg, pick(smith::rng));
35 I random_pick(std::pair<I,I> iters) {
36 return random_pick(iters.first, iters.second);
39 int d6(), d9(), d12(), d20(), d42(), d100();