Struct rand::EntropyRng [] [src]

pub struct EntropyRng { /* fields omitted */ }

A generator provided specifically for securely seeding algorithmic generators (PRNGs).

Where possible, EntropyRng retrieves random data from the operating system's interface for random numbers (OsRng); if that fails it will fall back to the JitterRng entropy collector. In the latter case it will still try to use OsRng on the next usage.

If no secure source of entropy is available EntropyRng will panic on use; i.e. it should never output predictable data.

This is either a little slow (OsRng requires a system call) or extremely slow (JitterRng must use significant CPU time to generate sufficient jitter). It is recommended to only use EntropyRng to seed a PRNG (as in thread_rng) or to generate a small key.

Methods

impl EntropyRng
[src]

[src]

Create a new EntropyRng.

This method will do no system calls or other initialization routines, those are done on first use. This is done to make new infallible, and try_fill_bytes the only place to report errors.

Trait Implementations

impl Debug for EntropyRng
[src]

[src]

Formats the value using the given formatter. Read more

impl RngCore for EntropyRng
[src]

[src]

Return the next random u32. Read more

[src]

Return the next random u64. Read more

[src]

Fill dest with random data. Read more

[src]

Fill dest entirely with random data. Read more

impl CryptoRng for EntropyRng
[src]

Auto Trait Implementations

impl Send for EntropyRng

impl Sync for EntropyRng