Function rand::thread_rng [] [src]

pub fn thread_rng() -> ThreadRng

Retrieve the lazily-initialized thread-local random number generator, seeded by the system. Intended to be used in method chaining style, e.g. thread_rng().gen::<i32>().

After generating a certain amount of randomness, the RNG will reseed itself from the operating system or, if the operating system RNG returns an error, a seed based on the current system time.

The internal RNG used is platform and architecture dependent, even if the operating system random number generator is rigged to give the same sequence always. If absolute consistency is required, explicitly select an RNG, e.g. IsaacRng or Isaac64Rng.