Struct bc_crypto::SecureRandomNumberGenerator
source · pub struct SecureRandomNumberGenerator;Expand description
A random number generator that can be used as a source of cryptographically-strong randomness.
Trait Implementations§
source§impl RandomNumberGenerator for SecureRandomNumberGenerator
impl RandomNumberGenerator for SecureRandomNumberGenerator
source§fn random_data(&mut self, size: usize) -> Vec<u8>
fn random_data(&mut self, size: usize) -> Vec<u8>
Returns a vector of random bytes of the given size.
source§fn fill_random_data(&mut self, data: &mut [u8])
fn fill_random_data(&mut self, data: &mut [u8])
Fills the given buffer with random bytes.
source§fn next_with_upper_bound<T>(&mut self, upper_bound: T) -> Twhere
T: PrimInt + Unsigned + NumCast + FromPrimitive + AsPrimitive<u128> + OverflowingMul + Shl<usize, Output = T> + Shr<usize, Output = T> + WrappingSub + OverflowingAdd + Widening,
fn next_with_upper_bound<T>(&mut self, upper_bound: T) -> Twhere T: PrimInt + Unsigned + NumCast + FromPrimitive + AsPrimitive<u128> + OverflowingMul + Shl<usize, Output = T> + Shr<usize, Output = T> + WrappingSub + OverflowingAdd + Widening,
Returns a random value that is less than the given upper bound. Read more
source§fn next_in_range<T>(&mut self, range: &Range<T>) -> Twhere
T: PrimInt + FromPrimitive + AsPrimitive<u128> + OverflowingMul + Shl<usize, Output = T> + Shr<usize, Output = T> + HasMagnitude + OverflowingAdd,
fn next_in_range<T>(&mut self, range: &Range<T>) -> Twhere T: PrimInt + FromPrimitive + AsPrimitive<u128> + OverflowingMul + Shl<usize, Output = T> + Shr<usize, Output = T> + HasMagnitude + OverflowingAdd,
Returns a random value within the specified range, using the given
generator as a source for randomness. Read more
fn next_in_closed_range<T>(&mut self, range: &RangeInclusive<T>) -> Twhere T: PrimInt + FromPrimitive + AsPrimitive<u128> + OverflowingMul + Shl<usize, Output = T> + Shr<usize, Output = T> + HasMagnitude,
Auto Trait Implementations§
impl RefUnwindSafe for SecureRandomNumberGenerator
impl Send for SecureRandomNumberGenerator
impl Sync for SecureRandomNumberGenerator
impl Unpin for SecureRandomNumberGenerator
impl UnwindSafe for SecureRandomNumberGenerator
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more