soliterm-model 0.1.0

Shared model types for soliterm
Documentation
use permutations::Permutation;
use rand::thread_rng;

pub trait Shuffle {
    fn permutation(self, len: usize) -> Permutation;
}

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct Random;

impl Shuffle for Random {
    fn permutation(self, len: usize) -> Permutation {
        Permutation::random(&mut thread_rng(), len)
    }
}

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct Noop;

impl Shuffle for Noop {
    fn permutation(self, len: usize) -> Permutation {
        Permutation::identity(len)
    }
}