BlockBuffer32<TBlockRng, TBlockCounter> Class
Assists in implementing seekable block based RNGs.
Namespace
RandN.Implementation
Interfaces
Base Types
  • object
BlockBuffer32<TBlockRng, TBlockCounter>
object
IRng

Syntax

public sealed class BlockBuffer32<TBlockRng, TBlockCounter> : IRng 
    where TBlockRng : ISeekableBlockRngCore<uint, TBlockCounter> where TBlockCounter : IEquatable<TBlockCounter>

Type Parameters

NameDescription
TBlockRng
TBlockCounter

Constructors

NameSummary
BlockBuffer32(TBlockRng)Constructs a new instance filled from rng.

Properties

NameProperty TypeSummary
BlockCounterTBlockCounter
The current block counter for the RNG.
Indexint
The index to the location within the current block.

Methods

NameReturn ValueSummary
Fill(Span<byte>)void
Completely fills the span with random bytes.
GenerateAndSet(int)void
Generates and stores the next block and sets Index to index.
NextUInt32()uint
Returns the next 32 bits in the sequence as a UInt32.
NextUInt64()ulong
Returns the next 64 bits in the sequence as a UInt64.

Extension Methods

NameValueSummary
Sample<BlockBuffer32<TBlockRng, TBlockCounter>, TDistribution, TResult>(TDistribution)TResult
Samples the distribution from rng.
Sample<BlockBuffer32<TBlockRng, TBlockCounter>, TResult>(IDistribution<TResult>)TResult
Samples the distribution from rng.
ShuffleInPlace<BlockBuffer32<TBlockRng, TBlockCounter>, T>(IList<T>)void
Shuffles a list using the in-place Fisher-Yates shuffling algorithm.