use super::RngCore;
use rand_core::{impls, CryptoRng, Error};
mod retry;
#[derive(Default)]
pub struct McRng;
impl CryptoRng for McRng {}
impl RngCore for McRng {
#[inline]
fn next_u32(&mut self) -> u32 {
retry::next_rdrand_u32_or_panic()
}
#[inline]
fn next_u64(&mut self) -> u64 {
#[cfg(target_arch = "x86")]
return impls::next_u64_via_u32(self);
#[cfg(target_arch = "x86_64")]
return retry::next_rdrand_u64_or_panic();
}
#[inline]
fn fill_bytes(&mut self, dest: &mut [u8]) {
impls::fill_bytes_via_next(self, dest)
}
#[inline]
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
self.fill_bytes(dest);
Ok(())
}
}