pcg_mwc/
lib.rs

1//! An implementation of a permeuted multiply with carry random number generator.
2//! Details about the design see: https://tom-kaitchuck.medium.com/designing-a-new-prng-1c4ffd27124d
3//!
4//! This library provides two generators:
5//!
6//! * `Mwc256XXA64` : A Lag-3 64bit MWC generator with two xors and an addition applied to the output.
7//!    It has an output size of 64bits, and a state size of 256bits. This algorithm is fastest on 64 bit architectures.
8//! * `Mwc256XXA64` : A Lag-3 32bit MWC generator with two xors and an addition applied to the output.
9//!    It has an output size of 32bits, and a state size of 128bits. This algorithm is fastest on 32 bit architectures.
10//!
11//!
12//! # Usage
13//!
14//! ```toml
15//! [dependencies]
16//! pcg-mwq = "0.2.1"
17//! ```
18//! # Typename Nomenclature
19//! The name describes the algorithm.
20//!
21//! 1. First Mwc stands for `Multiply with carry` this is the base generator type.
22//! 1. This is followed by the state sise in bits.
23//! 1. Third the output permutatuon which is used. Where `X` refers to 'xor' and `A` refers to addition.
24//! 1. Fourth is the output size in bits
25//!
26//! # How to Use
27//! The simple generators work like the other Rng's from the `rand` crate.
28//! You can create a prng as follows
29//!
30//! ```ignore
31//! extern crate pcg_mwc;
32//! extern crate rand;
33//!
34//! use rand::{Rng, SeedableRng};
35//! use pcg_mwc::Mwc256XXA64;
36//!
37//! fn main() {
38//!     let mut rand = Mwc256XXA64::from_entropy();
39//!
40//!     let x : u32 = rand.gen();
41//! }
42//! ```
43//!
44mod gen32;
45mod gen64;
46
47pub use gen32::Mwc128XXA32;
48pub use gen64::Mwc256XXA64;
49