Numerics.NET.Random.Generators Namespace

Provides Layer 2 generator structs that adapt Layer 1 engines into a uniform primitive RNG API.

Remarks

Layer 2 generators are generic structs that wrap Layer 1 engine types and implement the IRandomGenerator interface, providing three primitive operations:

Generator Types:

Design Principles:

  • All generators are structs for performance and should be passed by reference in hot paths.
  • 64-bit generators cache the high 32 bits when NextUInt32() is called.
  • All byte sequences are little-endian for cross-platform portability.
  • Counter-based generators guarantee the underlying engine is always in a consistent state when producing output.

Structures

BlockGenerator32<TEngine> A generator struct that adapts a 32-bit non-counter block engine into the IRandomGenerator interface.
BlockGenerator64<TEngine> A generator struct that adapts a 64-bit non-counter block engine into the IRandomGenerator interface, with uint caching for efficient 32-bit word generation.
CounterBasedGenerator32<TEngine> A generator struct that adapts a 32-bit counter-based engine into the IRandomGenerator interface.
CounterBasedGenerator64<TEngine> A generator struct that adapts a 64-bit counter-based engine into the IRandomGenerator interface, with uint caching for efficient 32-bit word generation.
ScalarGenerator32<TEngine> A generator struct that adapts a 32-bit scalar engine into the IRandomGenerator interface.
ScalarGenerator64<TEngine> A generator struct that adapts a 64-bit scalar engine into the IRandomGenerator interface, with uint caching for efficient 32-bit word generation.