A PCG random number generator (XSH RR 64/32 (LCG) variant).
- Namespace
- RandN
.Rngs - Interfaces
- Base Types
- object
Syntax
public sealed class Pcg32 : IRng
Remarks
Permuted Congruential Generator with 64-bit state, internal Linear Congruential Generator, and 32-bit output via "xorshift high (bits), random rotation" output function. This is a 64-bit LCG with explicitly chosen stream with the PCG-XSH-RR output function. This combination is the standard pcg32. Despite the name, this implementation uses 16 bytes (128 bit) space comprising 64 bits of state and a 64 bit stream selector. These are both set by
Pcg32.Factory
, using a 127-bit seed.Methods
Name | Return Value | Summary |
---|---|---|
Create | Pcg32 | Creates a new Pcg32 instance, treating state and stream the same way as the reference implementation of PCG.static |
Fill | void | Completely fills the span with random bytes. |
GetFactory | Pcg32 | Gets the XorShift factory.static |
NextUInt32 | uint | Returns the next 32 bits in the sequence as a UInt32. |
NextUInt64 | ulong | Returns the next 64 bits in the sequence as a UInt64. |
Extension Methods
Name | Value | Summary |
---|---|---|
ShuffleInPlace | void | Shuffles a list using the in-place Fisher-Yates shuffling algorithm. From RngExtensions |