Function rusty_machine::learning::toolkit::rand_utils::fisher_yates
source · [−]pub fn fisher_yates<T: Copy>(arr: &[T]) -> Vec<T>
Expand description
The inside out Fisher-Yates algorithm.
Examples
use rusty_machine::learning::toolkit::rand_utils;
// Collect the numbers 0..5
let a = (0..5).collect::<Vec<_>>();
// Perform a Fisher-Yates shuffle to get a random permutation
let permutation = rand_utils::fisher_yates(&a);