[−][src]Struct rand_seeder::Seeder
A universal seeder.
Seeder
can be used to seed any SeedableRng
from any hashable value. It
is portable and reproducible, and should turn any input into a good RNG
seed. It is intended for use in simulations and games where reproducibility
is important.
We do not recommend using Seeder
for cryptographic applications and
strongly advise against usage for authentication (password hashing).
Example:
use rand_core::RngCore; use rand_seeder::{Seeder, SipRng}; // Use any SeedableRng you like in place of SipRng: let mut rng: SipRng = Seeder::from("stripy zebra").make_rng(); println!("First value: {}", rng.next_u32());
Implementations
impl Seeder
[src]
pub fn make_rng<R: SeedableRng>(&mut self) -> R
[src]
Construct and seed a generator of any type R: SeedableRng
.
This function seeds a new RNG using an internal SipRng
generator.
Because of this, multiple independent RNGs may safely be constructed
from a single Seeder
.
Alternatively, one can obtain a SipRng
via
SipHasher::from(h).into_rng()
.
pub fn make_seed<S: AsMut<[u8]> + Default>(&mut self) -> S
[src]
Make a seed
This mutates the state internally, thus can be called multiple times to generate multiple independent seeds.
Trait Implementations
impl Clone for Seeder
[src]
fn clone(&self) -> Seeder
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Seeder
[src]
impl<H: Hash> From<H> for Seeder
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,