Table of Contents

Class LazyRandomState

Namespace
OptunaSharp.Samplers
Assembly
OptunaSharp.dll

Lazy Random State class. Port of optuna/samplers/_lazy_random_state.py.

This is a class to initialize the random state just before use to prevent duplication of the same random state when a sampler instance is copied.

Every sampler consumes randomness through this wrapper over NumSharp's NumPy-exact MT19937 RandomState — never Random — which is what makes differential testing against Python bit-exact (plan §2 RNG discipline).

public sealed class LazyRandomState
Inheritance
LazyRandomState
Inherited Members

Constructors

LazyRandomState(int?)

Creates a random-state holder, initializing immediately only when an explicit seed is supplied.

public LazyRandomState(int? seed = null)

Parameters

seed int?

Seed for subsequent random draws; null uses the generator default when permitted.

Properties

Rng

The underlying np.random.RandomState, created on first use.

public NumPyRandom Rng { get; }

Property Value

NumPyRandom