Struct SpaceSeed
What a space constructor's seed accepts, Gymnasium's int | np.random.Generator | None: an integer seed
for a fresh generator of the space's own, or an existing generator the space then shares. Callers never name this
type: seed: 42, seed: someBigInteger and seed: generator convert implicitly, and a
Nullable<T> null is None.
public readonly struct SpaceSeed : IEquatable<SpaceSeed>
- Implements
- Inherited Members
- Extension Methods
Remarks
Sharing a generator couples two streams (each draw by one moves the other), which is why Gymnasium allows it only on purpose; generators are not synchronized, so a shared one must stay on one thread.
Properties
Generator
The generator to share, or null for an integer seed.
public Generator? Generator { get; }
Property Value
Value
public BigInteger Value { get; }
Property Value
Methods
Equals(SpaceSeed)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(SpaceSeed other)
Parameters
otherSpaceSeedAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
implicit operator SpaceSeed?(Generator?)
A shared generator, or no seed for a null one: seed: maybeGenerator then means
Gymnasium's seed=None when the variable is unset.
public static implicit operator SpaceSeed?(Generator? generator)
Parameters
Returns
Remarks
The conversion targets Nullable<T> on purpose. Into the struct itself, a null
generator would have to throw, and C# also routes a bare null literal through this operator
wherever SpaceSeed is the natural type (x is null ? null : (SpaceSeed)x), which then threw on the
branch meant to be "no seed".
implicit operator SpaceSeed(int)
An integer seed.
public static implicit operator SpaceSeed(int value)
Parameters
valueintThe seed.
Returns
implicit operator SpaceSeed(long)
An integer seed.
public static implicit operator SpaceSeed(long value)
Parameters
valuelongThe seed.
Returns
implicit operator SpaceSeed(BigInteger)
An integer seed.
public static implicit operator SpaceSeed(BigInteger value)
Parameters
valueBigIntegerThe seed.
Returns
implicit operator SpaceSeed(ulong)
An integer seed.
public static implicit operator SpaceSeed(ulong value)
Parameters
valueulongThe seed.