IRandomGenerator Interface

Represents a random number generator that provides primitive integer and byte generation operations.

Definition

Namespace: Numerics.NET.Random
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
public interface IRandomGenerator : IStateful
Implements
IStateful

Remarks

This interface defines the minimal primitive API for random number generation:

Little-Endian Promise:

All bytes written by NextBytes(Span<Byte>) are written in little-endian order, ensuring portable and predictable byte sequences across all platforms.

Tail Consumption Rule:

When NextBytes(Span<Byte>) ends with a remainder smaller than the generator's natural word write size, it consumes one additional word and writes only the required low-order bytes.

Properties

StateSize Gets the number of bytes required to save/load this engine's state.
(Inherited from IStateful)

Methods

Fill(Span<Double>) Fills the specified span with random double-precision floating-point numbers.
Fill(Span<Single>) Fills the specified span with random single-precision floating-point numbers.
Fill(Span<UInt32>) Fills the specified span with random 32-bit unsigned integers.
Fill(Span<UInt64>) Fills the specified span with random 64-bit unsigned integers.
LoadState Loads the engine's state from the source span in a stable little-endian format.
(Inherited from IStateful)
NextBytes Fills the specified span with random bytes in little-endian order.
NextDouble Generates the next double-precision floating-point number.
NextSingle Generates the next single-precision floating-point number.
NextUInt32 Generates the next 32-bit unsigned integer.
NextUInt64 Generates the next 64-bit unsigned integer.
SaveState Saves the engine's state to the destination span in a stable little-endian format.
(Inherited from IStateful)

See Also