Skip to content

Commit

Permalink
Merge pull request #6348 from n8sh/isSeedable-fix
Browse files Browse the repository at this point in the history
Fix Issue 18663 - std.random.isSeedable has false positives
merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
  • Loading branch information
dlang-bot committed Mar 27, 2018
2 parents 83aca76 + e9f56ba commit 6400ada
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions std/random.d
Expand Up @@ -178,7 +178,8 @@ template isSeedable(Rng, SeedType)
is(typeof(
{
Rng r = void; // can define a Rng object
r.seed(SeedType.init); // can seed a Rng
SeedType s = void;
r.seed(s); // can seed a Rng
}));
}

Expand All @@ -189,7 +190,9 @@ template isSeedable(Rng)
is(typeof(
{
Rng r = void; // can define a Rng object
r.seed(typeof(r.front).init); // can seed a Rng
alias SeedType = typeof(r.front);
SeedType s = void;
r.seed(s); // can seed a Rng
}));
}

Expand Down Expand Up @@ -255,6 +258,7 @@ template isSeedable(Rng)
static assert(isUniformRNG!(seedRng, uint));
static assert(isUniformRNG!(seedRng));
static assert(isSeedable!(seedRng, uint));
static assert(!isSeedable!(seedRng, ulong));
static assert(isSeedable!(seedRng));
}

Expand Down

0 comments on commit 6400ada

Please sign in to comment.