rantz_random 1.2.1

Mostly just a wrapper around fastrand for a bunch of types. Supports bevy and rantz_spatial2d.
Documentation
use crate::prelude::RandomContainer;

/// Trait for shuffling a container
pub trait Shuffle<T>: RandomContainer<T> + FromIterator<T>
where
    T: Clone,
{
    /// Shuffles the container
    fn shuffle(&mut self) {
        let mut vec = self.clone().into_iter().collect::<Vec<_>>();
        vec.shuffle();
        *self = Self::from_iter(vec);
    }

    /// Returns a shuffled copy of the container
    fn shuffled(&self) -> Self {
        let mut vec = self.clone().into_iter().collect::<Vec<_>>();
        vec.shuffle();
        Self::from_iter(vec)
    }
}