#[cfg(test)]
pub struct MockRng(rand_xorshift::XorShiftRng);
#[cfg(test)]
impl rand_core::SeedableRng for MockRng {
type Seed = [u8; 16];
fn from_seed(seed: Self::Seed) -> Self {
Self(rand_xorshift::XorShiftRng::from_seed(seed))
}
}
#[cfg(test)]
impl rand_core::CryptoRng for MockRng {}
#[cfg(test)]
impl rand_core::RngCore for MockRng {
fn next_u32(&mut self) -> u32 {
self.0.next_u32()
}
fn next_u64(&mut self) -> u64 {
self.0.next_u64()
}
fn fill_bytes(&mut self, dest: &mut [u8]) {
self.0.fill_bytes(dest)
}
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> {
self.0.try_fill_bytes(dest)
}
}