Skip to main content

permutation

Function permutation 

Source
pub fn permutation(n: usize, seed: u64, stream: u64) -> Vec<usize>
Expand description

0..n shuffled by Fisher–Yates on stream stream of seed: the permutation that the model-agnostic explanations in the bindings apply to a column, so they shuffle alike in Python and R.

use prospicio_models::resample::permutation;

let mut p = permutation(6, 1, 0);
assert_eq!(p, permutation(6, 1, 0));
p.sort_unstable();
assert_eq!(p, (0..6).collect::<Vec<_>>());