This module is currently experimental and should be used with caution. It is not imported automatically as part of the hap.random package but must be imported individually in its own right. Its API may change in future releases. License:
Boost License 1.0. Authors:
Joseph Rushton Wakeling Source:
hap/random/device.d
- alias UniformRandomDeviceTypes = (RandomFileStream!("/dev/random", ushort), RandomFileStream!("/dev/random", uint), RandomFileStream!("/dev/random", ulong), RandomFileStream!("/dev/urandom", ushort), RandomFileStream!("/dev/urandom", uint), RandomFileStream!("/dev/urandom", ulong));
- TypeTuple of all random devices defined in this module. that act as a uniform random number generator. Note that the available random devices may be dependent on operating system and/or hardware architecture.
- class RandomFileStream(string filename, T) if (isIntegral!T && isUnsigned!T);
- Reads randomness from an infinite filestream. In practice this
will typically be used to read from system sources of randomness
such as (on Posix) /dev/random or /dev/urandom.
The random numbers generated will be unsigned integers of type
T in the range [T.min, T.max]. A good source of
randomness should ensure these are uniformly distributed.
It is the responsibility of the user to ensure that the specified
source of randomness indeed contains sufficient data to serve the
requirements of their program.
- bool empty;
const pure nothrow @property @safe T front();
void popFront(); - Range primitives
- bool empty;
- template DevRandom(T) if (isIntegral!T && isUnsigned!T)
- Generates uniformly distributed random numbers in the interval [T.min, T.max] using /dev/random as the source of randomness. Caution should be taken when using this as /dev/random is a blocking device.
- template DevURandom(T) if (isIntegral!T && isUnsigned!T)
- Generates uniformly distributed random numbers in the interval [T.min, T.max] using /dev/urandom as the source of randomness.