The Rust Rand Book

This is the extended documentation set for Rust's Random number lib (source).

See also:

Distinction between Rand and rand_core

The rand_core crate provides the necessary traits and functionality for implementing RNGs; this includes the RngCore and SeedableRng traits and the Error type. Crates implementing RNGs should depend on rand_core.

Applications and libraries consuming random values are encouraged to use the Rand crate, which re-exports the common parts of rand_core.


A quick introduction to the various crates, modules and traits.

Feature flags

A run-down of our feature gates (extra functionality).


Want an overview of how everything fits together? Or confused by some of the terminology used in this lib? Read the guide.


"Random number generation" often involves producing deterministic yet "random" data. If you wish to produce reproducible results (i.e. deterministic, stable and portable), then you should read this chapter.


A guide to upgrading to the next signficant version.


About contributing to the Rand project and running its tests and benchmarks.