sample_single_excluding_iteration

Function sample_single_excluding_iteration 

Source
pub fn sample_single_excluding_iteration<'a, R, T, E>(
    rng: &mut R,
    slice: &'a [T],
    excluded: E,
) -> Option<&'a T>
where R: Rng, T: PartialEq, E: Borrow<T>,
Expand description

Linear-scan implementation of sample_single_excluding. Counts non-excluded entries, then picks the k-th. Wins for very small slices (n <= 3) where the per-trial overhead of rejection sampling exceeds the cost of a tiny filter. Exposed so benchmarks can compare strategies directly.