Function rand::seq::sample_indices_cache [−][src]
fn sample_indices_cache<R>(
rng: &mut R,
length: usize,
amount: usize
) -> Vec<usize> where
R: Rng,
This method performs a partial fisher-yates on a range of indices using a HashMap as a cache to record potential collisions.
The cache avoids allocating the entire length
of values. This is especially useful when
amount <<< length
, i.e. select 3 non-repeating from 1_000_000