WrappedStreamRNG

Takes a RandomStream (ex: SystemEntropyStream or HashDRBGStream) and wraps it into a UniformRNG InputRange.

Note that to conform to the expected InputRange interface, this must keep a copy of the last generated value in memory. If using this for security-related purposes, it may occasionally be appropriate to make an extra popFront() call before and/or after retreiving entropy values. This may decrease the chance of using a compromized entropy value in the event of a memory-sniffing attacker.

Declaration:

struct WrappedStreamRNG(RandomStream, StaticUByteArr)
	if(isRandomStream!RandomStream && isStaticArray!StaticUByteArr && is(ElementType!StaticUByteArr==ubyte))
	{...}
  1. struct WrappedStreamRNG(RandomStream, StaticUByteArr)
    struct WrappedStreamRNG (
    RandomStream
    StaticUByteArr
    ) if (
    isRandomStream!RandomStream &&
    isStaticArray!StaticUByteArr
    &&
    is(ElementType!StaticUByteArr == ubyte)
    ) {
    enum isUniformRandom;
    }
  2. struct WrappedStreamRNG(RandomStream, UIntType)

Members

Functions

popFront
void popFront()

Implements an InputRange

Manifest constants

empty
enum empty;

Infinite range. Never empty.

min
enum min;

Smallest generated value.

Properties

front
StaticUByteArr front [@property getter]

Implements an InputRange

max
StaticUByteArr max [@property getter]

Largest generated value.

Variables

stream
RandomStream stream;

Access to underlying RandomStream so RNG-specific functionality can be accessed.

Meta