pub fn sample_multiple_from_known_length<'a, Container, R, T>(
rng: &mut R,
set: &'a Container,
requested: usize,
) -> Vec<T>
Expand description
Sample multiple random elements uniformly without replacement from a container of known length.
This function assumes set.len() >= requested
.
We do not assume the container is randomly indexable, only that it can be iterated over. The values are cloned.
This algorithm can be used when the property is indexed, and thus we know the length of the result set.
For very small requested
values (<=5), this algorithm is faster than reservoir because it doesn’t
iterate over the entire set.