"

Pcg32 Class

Summary

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

NameValueSummary
Create(ulong, ulong)Pcg32
Creates a new Pcg32 instance, treating state and stream the same way as the reference implementation of PCG.
static
Fill(Span<byte>)void
Completely fills the span with random bytes.
GetFactory()Pcg32.Factory
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.