| 229 | // Example call: random_elements(std::random_device()(), 10, xs) |
| 230 | template <typename Container> |
| 231 | Container random_elements( |
| 232 | std::uint_fast32_t seed, std::size_t n, const Container& xs) |
| 233 | { |
| 234 | assert(is_not_empty(xs)); |
| 235 | std::mt19937 gen(seed); |
| 236 | std::uniform_int_distribution<std::size_t> dis(0, size_of_cont(xs) - 1); |
| 237 | const auto draw = [&]() -> typename Container::value_type { |
| 238 | return elem_at_idx(dis(gen), xs); |
| 239 | }; |
| 240 | return generate<Container>(draw, n); |
| 241 | } |
| 242 | |
| 243 | // API search type: apply_functions : ([(a -> b)], a) -> [b] |
| 244 | // fwd bind count: 1 |
no test coverage detected