isSeedable

Test if Rng is seedable. The overload taking a SeedType also makes sure that the Rng can be seeded with SeedType.

A seedable random-number generator has the following additional features:

  • it has a 'seed(ElementType)' function
  1. template isSeedable(Rng, SeedType)
  2. template isSeedable(Rng)
    template isSeedable (
    Rng
    ) {
    enum bool isSeedable;
    }

Examples

struct validRng
{
    @property uint front() {return 0;}
    @property bool empty() {return false;}
    void popFront() {}

    enum isUniformRandom = true;
}
static assert(!isSeedable!(validRng, uint));
static assert(!isSeedable!(validRng));

struct seedRng
{
    @property uint front() {return 0;}
    @property bool empty() {return false;}
    void popFront() {}
    void seed(uint val){}
    enum isUniformRandom = true;
}
static assert(isSeedable!(seedRng, uint));
static assert(!isSeedable!(seedRng, ulong));
static assert(isSeedable!(seedRng));

Meta