pub struct ChaCha<const ROUNDS: u8> { /* private fields */ }
Expand description
An instance of the ChaCha random number generator. Seeded from the system entropy generator when available. This generator is theoretically cryptographically secure.
Implementations
Trait Implementations
sourceimpl<const ROUNDS: u8> Rng<64_usize> for ChaCha<ROUNDS>
impl<const ROUNDS: u8> Rng<64_usize> for ChaCha<ROUNDS>
sourcefn rand(&mut self) -> [u8; 64]
fn rand(&mut self) -> [u8; 64]
Generates a random sequence of bytes, seeding from the internal state.
sourcefn generate<Generated>(&mut self) -> Generated where
Generated: RandomGen<Self, OUTPUT>,
fn generate<Generated>(&mut self) -> Generated where
Generated: RandomGen<Self, OUTPUT>,
Generates a random of the specified type, seeding from the internal state.
sourcefn fill_bytes<Bytes>(&mut self, buffer: Bytes) where
Bytes: AsMut<[u8]>,
fn fill_bytes<Bytes>(&mut self, buffer: Bytes) where
Bytes: AsMut<[u8]>,
Fill an array of bytes with randomness.
sourcefn fill<Contents, Array>(&mut self, target: Array) where
Contents: RandomGen<Self, OUTPUT>,
Array: AsMut<[Contents]>,
fn fill<Contents, Array>(&mut self, target: Array) where
Contents: RandomGen<Self, OUTPUT>,
Array: AsMut<[Contents]>,
Fill an array with the specified type.
sourcefn generate_range<Number, Bounds>(&mut self, range: Bounds) -> Number where
Number: RandomRange<Self, OUTPUT>,
Bounds: RangeBounds<Number>,
fn generate_range<Number, Bounds>(&mut self, range: Bounds) -> Number where
Number: RandomRange<Self, OUTPUT>,
Bounds: RangeBounds<Number>,
Generates a random of the specified type, seeding from the internal state.
Auto Trait Implementations
impl<const ROUNDS: u8> RefUnwindSafe for ChaCha<ROUNDS>
impl<const ROUNDS: u8> Send for ChaCha<ROUNDS>
impl<const ROUNDS: u8> Sync for ChaCha<ROUNDS>
impl<const ROUNDS: u8> Unpin for ChaCha<ROUNDS>
impl<const ROUNDS: u8> UnwindSafe for ChaCha<ROUNDS>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more