Function diem_proptest_helpers::pick_slice_idxs
source · pub fn pick_slice_idxs(
max: usize,
indexes: &[impl AsRef<PropIndex>]
) -> Vec<usize> ⓘ
Expand description
Given a maximum value max
and a slice of Index
instances, picks
integers in the range [0, max)
uniformly randomly and without duplication.
If the number of Index
instances is greater than max
, all indexes will be returned.
This function implements Robert Floyd’s F2 algorithm for sampling without replacement.