Function rusty_machine::learning::toolkit::rand_utils::fisher_yates [] [src]

pub fn fisher_yates<T: Copy>(arr: &[T]) -> Vec<T>

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);