Table of Contents

Class SeedSequence

Namespace
NumSharp
Assembly
NumSharp.dll

Mixes an arbitrary seed into a high-quality initial state for a bit generator.

public sealed class SeedSequence
Inheritance
SeedSequence
Inherited Members

Remarks

Port of NumPy 2.4.2's numpy.random.SeedSequence (numpy/random/bit_generator.pyx). The entropy-mixing hash and generate_state are byte-for-byte identical to NumPy, so Generator/PCG64 seeded from the same integer reproduce NumPy's exact stream. Spawning and multi-source (spawn-key) entropy are intentionally omitted (not needed by default_rng).

Constructors

SeedSequence()

Constructs a sequence from fresh, unpredictable OS entropy (NumPy's seed=None).

public SeedSequence()

SeedSequence(int[])

Constructs a sequence from a sequence of non-negative integers.

public SeedSequence(int[] entropy)

Parameters

entropy int[]

SeedSequence(long)

Constructs a sequence from a single non-negative integer seed.

public SeedSequence(long entropy)

Parameters

entropy long

SeedSequence(long[])

Constructs a sequence from a sequence of non-negative integers.

public SeedSequence(long[] entropy)

Parameters

entropy long[]

SeedSequence(BigInteger)

Constructs a sequence from a single non-negative integer seed of arbitrary size.

public SeedSequence(BigInteger entropy)

Parameters

entropy BigInteger

SeedSequence(uint[])

Constructs a sequence directly from a uint32 word array (NumPy's uint32-ndarray pass-through).

public SeedSequence(uint[] entropy)

Parameters

entropy uint[]

SeedSequence(ulong)

Constructs a sequence from a single non-negative integer seed.

public SeedSequence(ulong entropy)

Parameters

entropy ulong

Properties

entropy

The seed this sequence was constructed from (NumPy SeedSequence.entropy).

public object entropy { get; }

Property Value

object

pool

The mixed uint32 entropy pool (NumPy SeedSequence.pool).

public uint[] pool { get; }

Property Value

uint[]

pool_size

The number of uint32 words in the entropy pool (NumPy SeedSequence.pool_size; always 4 here).

public int pool_size { get; }

Property Value

int

Methods

generate_state(int, DType)

Return the requested number of words for PRNG seeding (NumPy generate_state(n_words, dtype=np.uint32)). Returns a uint[] for uint32 (the default) or a ulong[] for uint64.

public Array generate_state(int n_words, DType dtype = null)

Parameters

n_words int
dtype DType

Returns

Array