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

source§

fn next_u64(&mut self) -> u64

Returns the next random u64.
source§

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])

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,

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,

Returns a random value within the specified range, using the given generator as a source for randomness. Read more
source§

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§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V