RipShuffleSequential

Trait RipShuffleSequential 

Source
pub trait RipShuffleSequential {
    // Required method
    fn seq_shuffle<R: Rng>(&mut self, rng: &mut R);
}

Required Methods§

Source

fn seq_shuffle<R: Rng>(&mut self, rng: &mut R)

Rearranges the input in a random permutation, such that any order appears with equal probability. The permutation only depends on the random number generator. If a deterministic sequence is provided, the output is the same each run with the same build on the same machine.

§Warning

We might change the algorithm or fine-tune the its parameters. Therefore, the emitted order might change with future revisions of the code.

§Example
use rip_shuffle::RipShuffleSequential;
let mut data : Vec<_> = (0..100).into_iter().collect();
let org = data.clone();

data.seq_shuffle(&mut rand::thread_rng());

assert_ne!(data, org); // might fail with probility 1 / 100!

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> RipShuffleSequential for [T]

Source§

fn seq_shuffle<R: Rng>(&mut self, rng: &mut R)

Implementors§