[Issue 18663] New: std.random.isSeedable has false positives
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 26 15:42:26 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18663
Issue ID: 18663
Summary: std.random.isSeedable has false positives
Product: D
Version: D2
Hardware: All
URL: http://dlang.org/
OS: All
Status: NEW
Severity: normal
Priority: P3
Component: phobos
Assignee: nobody at puremagic.com
Reporter: n8sh.secondary at hotmail.com
Example of wrong behavior:
```d
int main()
{
import std.random : isSeedable, isUniformRNG;
struct Rnd
{
@property uint front() {return 0;}
@property bool empty() {return false;}
void popFront() {}
void seed(uint val){}
enum isUniformRandom = true;
}
static assert(isUniformRNG!Rnd);
static assert(isSeedable!(Rnd, ulong)); // Passes erroneously.
Rnd rnd;
rnd.seed(ulong.max); // Compile-time failure because seed isn't callable
with ulong.
return rnd.front;
}
```
--
More information about the Digitalmars-d-bugs
mailing list