Trait rip_shuffle::api::RipShuffleSequential
source · pub trait RipShuffleSequential {
// Required method
fn seq_shuffle<R: Rng>(&mut self, rng: &mut R);
}
Required Methods§
sourcefn seq_shuffle<R: Rng>(&mut self, rng: &mut R)
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!
Object Safety§
This trait is not object safe.