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//! -   `Pcg64` aka `Lcg128Xsl64`, officially known as `pcg64`, a general
21//!     purpose RNG. This is a good choice on 64-bit CPUs.
22//! -   `Pcg64Mcg` aka `Mcg128Xsl64`, officially known as `pcg64_fast`,
23//!     a general purpose RNG using 128-bit multiplications. This has poor
24//!     performance on 32-bit CPUs but is a good choice on 64-bit CPUs for
25//!     both 32-bit and 64-bit output.
26//!
27//! Both of these use 16 bytes of state and 128-bit seeds, and are considered
28//! value-stable (i.e. any change affecting the output given a fixed seed would
29//! be considered a breaking change to the crate).
30
31#![doc(
32    html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
33    html_favicon_url = "https://www.rust-lang.org/favicon.ico",
34    html_root_url = "https://rust-random.github.io/rand/"
35)]
36#![deny(missing_docs)]
37#![deny(missing_debug_implementations)]
38#![no_std]
39
40#[cfg(not(target_os = "emscripten"))] mod pcg128;
41mod pcg64;
42
43#[cfg(not(target_os = "emscripten"))]
44pub use self::pcg128::{Lcg128Xsl64, Mcg128Xsl64, Pcg64, Pcg64Mcg};
45pub use self::pcg64::{Lcg64Xsh32, Pcg32};