pub fn sample_single_excluding_rejection<'a, R, T, E>(
rng: &mut R,
slice: &'a [T],
excluded: E,
) -> Option<&'a T>Expand description
Rejection-sampling implementation of sample_single_excluding. Picks a
uniform index, accepts if not equal to excluded. Wins at n >= 4 and is
essentially constant time when excluded appears 0 or 1 times. Falls
through to sample_single_excluding_iteration after at most 16 consecutive
matches (or n, whichever is smaller), which also returns None when
every element matches. Exposed so benchmarks can compare strategies
directly.