pub struct StdRng(_);
Expand description
The standard RNG. The PRNG algorithm in StdRng
is chosen to be efficient
on the current platform, to be statistically strong and unpredictable
(meaning a cryptographically secure PRNG).
The current algorithm used is the ChaCha block cipher with 12 rounds. Please see this relevant rand issue for the discussion. This may change as new evidence of cipher security and performance becomes available.
The algorithm is deterministic but should not be considered reproducible due to dependence on configuration and possible replacement in future library versions. For a secure reproducible generator, we recommend use of the rand_chacha crate directly.
Trait Implementations
sourceimpl RngCore for StdRng
impl RngCore for StdRng
sourcefn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill dest
with random data. Read more
sourceimpl SeedableRng for StdRng
impl SeedableRng for StdRng
type Seed = <ChaCha12Rng as SeedableRng>::Seed
type Seed = <ChaCha12Rng as SeedableRng>::Seed
Seed type, which is restricted to types mutably-dereferencable as u8
arrays (we recommend [u8; N]
for some N
). Read more
sourcefn from_rng<R: RngCore>(rng: R) -> Result<Self, Error>
fn from_rng<R: RngCore>(rng: R) -> Result<Self, Error>
Create a new PRNG seeded from another Rng
. Read more
sourcefn seed_from_u64(state: u64) -> Self
fn seed_from_u64(state: u64) -> Self
Create a new PRNG using a u64
seed. Read more
sourcefn from_entropy() -> Self
fn from_entropy() -> Self
impl CryptoRng for StdRng
impl Eq for StdRng
impl StructuralEq for StdRng
impl StructuralPartialEq for StdRng
Auto Trait Implementations
impl RefUnwindSafe for StdRng
impl Send for StdRng
impl Sync for StdRng
impl Unpin for StdRng
impl UnwindSafe for StdRng
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