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

The RNG provided will reseed itself from the operating system after generating a certain amount of randomness.

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.