Function diem_proptest_helpers::pick_idxs
source · pub fn pick_idxs<T, P>(max: usize, indexes: &T, indexes_len: usize) -> Vec<usize> ⓘwhere
T: OpsIndex<usize, Output = P> + ?Sized,
P: AsRef<PropIndex>,
Expand description
Given a maximum value max
and a list of Index
instances, picks
integers in the range [0, max)
uniformly randomly and without duplication.
If indexes_len
is greater than max
, all indexes will be returned.
This function implements Robert Floyd’s F2 algorithm for sampling without replacement.