rusty-perm 0.2.0

Rusty permutation with no-std
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![cfg(feature = "rand")]

use crate::perm_type::PermS;
use rand::{
    distributions::{Distribution, Standard},
    prelude::*,
};

impl<const SIZE: usize> Distribution<PermS<SIZE>> for Standard {
    /// Sample an random static permutation.
    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> PermS<SIZE> {
        let mut perm = PermS::<SIZE>::identity();
        perm.indices.shuffle(rng);
        perm
    }
}