rand_pcg/
lib.rs

1// Copyright 2018 Developers of the Rand project.
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9//! The PCG random number generators.
10//! 
11//! This is a native Rust implementation of a small selection of PCG generators.
12//! The primary goal of this crate is simple, minimal, well-tested code; in
13//! other words it is explicitly not a goal to re-implement all of PCG.
14//! 
15//! This crate provides:
16//! 
17//! -   `Pcg32` aka `Lcg64Xsh32`, officially known as `pcg32`, a general
18//!     purpose RNG. This is a good choice on both 32-bit and 64-bit CPUs
19//!     (for 32-bit output).
20//! -   `Pcg64Mcg` aka `Mcg128Xsl64`, officially known as `mcg_xsl_rr_128_64`,
21//!     a general purpose RNG using 128-bit multiplications. This has poor
22//!     performance on 32-bit CPUs but is a good choice on 64-bit CPUs for
23//!     both 32-bit and 64-bit output. (Note: this RNG is only available using
24//!     Rust 1.26 or later.)
25//!
26//! Both of these use 16 bytes of state and 128-bit seeds, and are considered
27//! value-stable (i.e. any change affecting the output given a fixed seed would
28//! be considered a breaking change to the crate).
29
30#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
31       html_favicon_url = "https://www.rust-lang.org/favicon.ico",
32       html_root_url = "https://docs.rs/rand_pcg/0.1.1")]
33
34#![deny(missing_docs)]
35#![deny(missing_debug_implementations)]
36#![doc(test(attr(allow(unused_variables), deny(warnings))))]
37
38#![cfg_attr(not(all(feature="serde1", test)), no_std)]
39
40extern crate rand_core;
41
42#[cfg(feature="serde1")] extern crate serde;
43#[cfg(feature="serde1")] #[macro_use] extern crate serde_derive;
44
45// To test serialization we need bincode and the standard library
46#[cfg(all(feature="serde1", test))] extern crate bincode;
47#[cfg(all(feature="serde1", test))] extern crate std as core;
48
49mod pcg64;
50#[cfg(rust_1_26)] mod pcg128;
51
52pub use self::pcg64::{Pcg32, Lcg64Xsh32};
53#[cfg(rust_1_26)] pub use self::pcg128::{Pcg64Mcg, Mcg128Xsl64};