fn random_idx_where<R, T, P>(
rng: &mut R,
slice: &mut [T],
predicate: P,
) -> Option<usize>Expand description
Helper: find a random item elt in slice such that predicate(elt) is
true. Return the index of that item.
Can arbitrarily reorder slice. This allows us to visit the indices in uniform-at-random
order, without having to do any O(N) operations or allocations.