[][src]Struct rand_seeder::Seeder

pub struct Seeder { /* fields omitted */ }

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());

Methods

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().

Trait Implementations

impl<H: Hash> From<H> for Seeder[src]

impl Debug for Seeder[src]

impl Clone for Seeder[src]

Auto Trait Implementations

impl Unpin for Seeder

impl Send for Seeder

impl Sync for Seeder

Blanket Implementations

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]