An open API service indexing awesome lists of open source software.

https://github.com/adambudziak/shuffle

Various shuffling algorithms for rust
https://github.com/adambudziak/shuffle

mix rust shuffle

Last synced: 3 months ago
JSON representation

Various shuffling algorithms for rust

Awesome Lists containing this project

README

          

# shuffle
Various shuffling algorithms for rust.

## Currently implemented shuffling algorithms
- [x] Inverse Riffle Shuffle
- [x] 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]);
```