# Crate pcg_mwc[−][src]

## Expand description

An implementation of a permeuted multiply with carry random number generator. Details about the design see: https://tom-kaitchuck.medium.com/designing-a-new-prng-1c4ffd27124d

This library provides two generators:

`Mwc256XXA64`

: A Lag-3 64bit MWC generator with two xors and an addition applied to the output. It has an output size of 64bits, and a state size of 256bits. This algorithm is fastest on 64 bit architectures.`Mwc256XXA64`

: A Lag-3 32bit MWC generator with two xors and an addition applied to the output. It has an output size of 32bits, and a state size of 128bits. This algorithm is fastest on 32 bit architectures.

# Usage

```
[dependencies]
pcg-mwq = "0.2.1"
```

# Typename Nomenclature

The name describes the algorithm.

- First Mwc stands for
`Multiply with carry`

this is the base generator type. - This is followed by the state sise in bits.
- Third the output permutatuon which is used. Where
`X`

refers to ‘xor’ and`A`

refers to addition. - Fourth is the output size in bits

# How to Use

The simple generators work like the other Rng’s from the `rand`

crate.
You can create a prng as follows

ⓘ

extern crate pcg_mwc; extern crate rand; use rand::{Rng, SeedableRng}; use pcg_mwc::Mwc256XXA64; fn main() { let mut rand = Mwc256XXA64::from_entropy(); let x : u32 = rand.gen(); }

## Structs

Mwc128XXA32 | A PCG random number generator (MWC X A 128/32 variant). |

Mwc256XXA64 | A PCG random number generator (MWC X A 256/64 variant). |