Function sample_array

fn sample_array<R, N: usize>(rng: &mut R, len: usize) -> Option<[usize; N]>
where
    R: Rng + ?Sized

Randomly sample exactly N distinct indices from 0..len, and return them in random order (fully shuffled).

This is implemented via Floyd's algorithm. Time complexity is O(N^2) and memory complexity is O(N).

Returns None if (and only if) N > len.