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 moresourcefn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>
Fill
dest
entirely with random data. Read moresourceimpl 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-dereferenceable as
u8
arrays (we recommend [u8; N]
for some N
). Read moresourcefn 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 moresourcefn seed_from_u64(state: u64) -> Self
fn seed_from_u64(state: u64) -> Self
Create a new PRNG using a
u64
seed. Read moresourcefn 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
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CryptoRngCore for Twhere
T: CryptoRng + RngCore,
impl<T> CryptoRngCore for Twhere
T: CryptoRng + RngCore,
sourcefn as_rngcore(&mut self) -> &mut dyn RngCore
fn as_rngcore(&mut self) -> &mut dyn RngCore
Upcast to an
RngCore
trait object.impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. Read more