| 213 | // Also known as choice. |
| 214 | template <typename Container> |
| 215 | typename Container::value_type random_element( |
| 216 | std::uint_fast32_t seed, const Container& xs) |
| 217 | { |
| 218 | assert(is_not_empty(xs)); |
| 219 | std::mt19937 gen(seed); |
| 220 | std::uniform_int_distribution<std::size_t> dis(0, size_of_cont(xs) - 1); |
| 221 | return elem_at_idx(dis(gen), xs); |
| 222 | } |
| 223 | |
| 224 | // API search type: random_elements : (Int, Int, [a]) -> a |
| 225 | // fwd bind count: 2 |
no test coverage detected