# 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`.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)