SeedSequence.FillBytes Method

Fills a span of bytes with entropy values.

Definition

Namespace: Numerics.NET.Random
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
public virtual void FillBytes(
	Span<byte> buffer
)

Parameters

buffer  Span<Byte>
The span to fill with entropy bytes.

Remarks

This method provides a deterministic byte-stream API using little-endian byte order for expanding 32-bit values. This is particularly useful for counter-based RNGs and cipher-based wrappers that require byte-level initialization (e.g., ChaCha keys/nonces).

The method fills as many complete 32-bit words as possible, then handles any remaining 1-3 bytes by extracting them from a final 32-bit word.

  Important

Each 4-byte block consumes one 32-bit entropy value from the stream. Partial blocks (1-3 trailing bytes) consume an additional 32-bit value.

See Also