Table of Contents

Class PCG64.State

Namespace
NumSharp
Assembly
NumSharp.dll

The PCG64 state — NumPy's {'bit_generator': 'PCG64', 'state': {'state': int, 'inc': int}, 'has_uint32': int, 'uinteger': int} with the nested 'state' dict flattened.

public class PCG64.State : BitGeneratorState
Inheritance
PCG64.State
Inherited Members

Remarks

Unsealed, so a subclass engine that adds state of its own derives its snapshot from this class. Its GetStateCore() override returns the derived snapshot, which passes the typed state getter (a cast to PCG64.State) and SetStateCore(BitGeneratorState) (an is State test); its SetStateCore(BitGeneratorState) override restores its own fields and calls the base for the engine's. Footgun: the bit_generator label stays "PCG64" and the base SetStateCore(BitGeneratorState) takes any PCG64.State, where NumPy labels a subclass's state with the subclass's class name and refuses another class's state.

Constructors

State()

Creates an all-zero state (fill the members before assigning it).

public State()

State(UInt128, UInt128, int, uint)

Creates a state from its four members.

public State(UInt128 state, UInt128 inc, int has_uint32 = 0, uint uinteger = 0)

Parameters

state UInt128

The 128-bit LCG state.

inc UInt128

The 128-bit LCG increment (stream selector; odd in any seeded state).

has_uint32 int

Non-zero when a buffered 32-bit half is pending.

uinteger uint

The buffered 32-bit half.

Properties

bit_generator

NumPy's 'bit_generator' key: the name of the bit generator class this state belongs to.

public override string bit_generator { get; }

Property Value

string

has_uint32

Non-zero when a buffered 32-bit half is pending (NumPy stores the int as given).

public int has_uint32 { get; set; }

Property Value

int

inc

The 128-bit LCG increment (NumPy state['state']['inc']).

public UInt128 inc { get; set; }

Property Value

UInt128

state

The 128-bit LCG state (NumPy state['state']['state']).

public UInt128 state { get; set; }

Property Value

UInt128

uinteger

The buffered 32-bit half (meaningful only when has_uint32 is non-zero).

public uint uinteger { get; set; }

Property Value

uint