[Issue 21383] New: std.random.uniform!T(urng) when T is dchar disregards urng and always uses a thread-local random
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 13 02:45:19 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21383
Issue ID: 21383
Summary: std.random.uniform!T(urng) when T is dchar disregards
urng and always uses a thread-local random
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: n8sh.secondary at hotmail.com
std.random.uniform!T(urng) when T is dchar disregards urng and always uses a
thread-local random
Demonstration:
---
void main()
{
// The following loop is unlikely to complete without an assertion failure:
foreach (_; 0 .. 100)
{
import std.random : uniform, Xorshift32;
auto rng0 = Xorshift32(123456789);
auto rng1 = Xorshift32(123456789);
assert(uniform!dchar(rng0) == uniform!dchar(rng1));
}
}
---
--
More information about the Digitalmars-d-bugs
mailing list