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§
source§impl<const ROUNDS: u8> Rng<64> for ChaCha<ROUNDS>
impl<const ROUNDS: u8> Rng<64> for ChaCha<ROUNDS>
source§fn rand(&mut self) -> [u8; 64]
fn rand(&mut self) -> [u8; 64]
Generates a random sequence of bytes, seeding from the internal state.
source§fn generate<Generated>(&mut self) -> Generatedwhere
Generated: RandomGen<Self, OUTPUT>,
fn generate<Generated>(&mut self) -> Generatedwhere
Generated: RandomGen<Self, OUTPUT>,
Generates a random of the specified type, seeding from the internal state.
source§fn fill_bytes<Bytes>(&mut self, buffer: Bytes)
fn fill_bytes<Bytes>(&mut self, buffer: Bytes)
Fill an array of bytes with randomness.
source§fn generate_range<Number, Bounds>(&mut self, range: Bounds) -> Numberwhere
Number: RandomRange<Self, OUTPUT>,
Bounds: RangeBounds<Number>,
fn generate_range<Number, Bounds>(&mut self, range: Bounds) -> Numberwhere
Number: RandomRange<Self, OUTPUT>,
Bounds: RangeBounds<Number>,
Generates a random of the specified type, seeding from the internal state.
source§fn shuffle<Contents, Array>(&mut self, target: Array)where
Array: AsMut<[Contents]>,
fn shuffle<Contents, Array>(&mut self, target: Array)where
Array: AsMut<[Contents]>,
Shuffle a slice, using the RNG.
Auto Trait Implementations§
impl<const ROUNDS: u8> Freeze for ChaCha<ROUNDS>
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§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)