shuffle

Crates.ioshuffle
lib.rsshuffle
version0.1.7
sourcesrc
created_at2019-10-01 17:33:26.105251
updated_at2021-09-30 17:48:48.62729
descriptionImplementation of various shuffling algorithms over slices.
homepage
repositoryhttps://github.com/adambudziak/shuffle
max_upload_size
id169150
size12,367
Adam Budziak (adambudziak)

documentation

https://docs.rs/shuffle

README

shuffle

Various shuffling algorithms for rust.

Currently implemented shuffling algorithms

  • Inverse Riffle Shuffle
  • Fisher-Yates
  • ... ? TODO

Examples

use shuffle::shuffler::Shuffler;
use shuffle::irs::Irs;
use rand::rngs::mock::StepRng;

let mut rng = StepRng::new(2, 13);
let mut irs = Irs::default();
let mut input = vec![1, 2, 3, 4, 5];

irs.shuffle(&mut input, &mut rng);
assert_eq!(&input, &[4, 1, 5, 3, 2]);
Commit count: 23

cargo fmt