1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
//! Pseudorandomness facilities. //! //! This library mainly provides the [`RandomGen`] trait for (pseudo-)random //! number generators, the [`Random`] trait for values that can be randomly //! generated, and the [`BuildRandom`] generating representing relationships //! between distributions and their generated types. //! Of course, instances of these traits for common types from the standard //! library are provided. //! //! Additionally, it also provides the [`Pcg`] PRNG, which supports multiple //! streams of randomness, has a long period, and is Quite Fast™ while having //! fairly good statistical properties. While it is not cryptographically //! secure, it is quite suited for purposes of e.g. generating levels or other //! things. //! //! [`BuildRandom`]: trait.BuildRandom.html //! [`Pcg`]: struct.Pcg.html //! [`Random`]: trait.Random.html //! [`RandomGen`]: trait.RandomGen.html // TODO @Feature add a `shuffle` method/iterator (taking `&[T]` or `&mut [T]`) #![deny(missing_docs)] mod build_random; mod os; mod pcg; mod random; mod random_gen; pub use self::build_random::{BuildRandom, Const}; pub use self::os::{OsRng, HAS_OS_RNG}; pub use self::pcg::Pcg; pub use self::random::Random; pub use self::random_gen::{IterBuild, IterChooseFrom, IterGen, RandomGen};