pub struct DevRng(_);
Expand description
Reproducible random generator for tests
Implementations§
source§impl DevRng
impl DevRng
sourcepub fn new() -> Self
pub fn new() -> Self
Constructs randomness generator
Reads a seed from env variable RUST_TESTS_SEED
or generates a random seed if env variable is not set.
Prints seed to stdout.
Panics if RUST_TESTS_SEED
contains invalid value.
Trait Implementations§
source§impl RngCore for DevRng
impl RngCore for DevRng
source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest
with random data. Read moresource§impl SeedableRng for DevRng
impl SeedableRng for DevRng
§type Seed = <ChaCha8Rng as SeedableRng>::Seed
type Seed = <ChaCha8Rng as SeedableRng>::Seed
Seed type, which is restricted to types mutably-dereferenceable as
u8
arrays (we recommend [u8; N]
for some N
). Read moresource§fn seed_from_u64(state: u64) -> Self
fn seed_from_u64(state: u64) -> Self
Create a new PRNG using a
u64
seed. Read moresource§fn 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 moresource§fn from_entropy() -> Self
fn from_entropy() -> Self
impl CryptoRng for DevRng
Auto Trait Implementations§
impl RefUnwindSafe for DevRng
impl Send for DevRng
impl Sync for DevRng
impl Unpin for DevRng
impl UnwindSafe for DevRng
Blanket Implementations§
source§impl<T> CryptoRngCore for Twhere
T: CryptoRng + RngCore,
impl<T> CryptoRngCore for Twhere T: CryptoRng + RngCore,
source§fn as_rngcore(&mut self) -> &mut dyn RngCore
fn as_rngcore(&mut self) -> &mut dyn RngCore
Upcast to an
RngCore
trait object.