RandomSource<TGenerator>.Uncached Property

Gets an uncached facade for this random number generator.

Definition

Namespace: Numerics.NET.Random
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
public RandomSource<TGenerator>.UncachedFacade Uncached { get; }

Property Value

RandomSource<TGenerator>.UncachedFacade
An RandomSource<TGenerator>.UncachedFacade instance that forces full 64-bit consumption per value for 32-bit and smaller outputs.

Remarks

The uncached facade is only available for 64-bit word RNGs (BitsPerWord = 64). It provides methods that consume a full 64-bit random value for each call, even when returning smaller types like UInt32, Int32, or Single.

Use Cases:

  • Compatibility modes requiring strict 64-bit consumption per value
  • Testing and validation against reference implementations that use full-width values
  • Scenarios where caching behavior must be avoided for reproducibility

  Caution

The uncached facade is less efficient than the standard API because it discards entropy. For example, NextUInt32() discards the lower 32 bits of each 64-bit value. Use only when full-width consumption is required.

Example

C#
var rng = new Xoshiro256StarStar(42);

// Standard API uses caching - efficient but may consume partial values
uint v1 = rng.NextUInt32(); // May cache lower bits

// Uncached API always consumes full 64-bit values
uint v2 = rng.Uncached.NextUInt32(); // Discards lower 32 bits

See Also