D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21383 - std.random.uniform!T(urng) when T is dchar disregards urng and always uses a thread-local random
Summary: std.random.uniform!T(urng) when T is dchar disregards urng and always uses a ...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-11-13 02:45 UTC by Nathan S.
Modified: 2020-11-18 08:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nathan S. 2020-11-13 02:45:19 UTC
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));
    }
}
---
Comment 1 Dlang Bot 2020-11-13 15:00:18 UTC
@n8sh created dlang/phobos pull request #7695 "Fix problems with std.random.uniform!dchar(urng)" fixing this issue:

- Fix Issue 21383 - std.random.uniform!T(urng) when T is dchar disregards urng and always uses a thread-local random

https://github.com/dlang/phobos/pull/7695
Comment 2 Dlang Bot 2020-11-18 08:03:56 UTC
dlang/phobos pull request #7695 "Fix problems with std.random.uniform!dchar(urng)" was merged into stable:

- f5c9556e484f04f386cb6f1db3e337312b89eb81 by Nathan Sashihara:
  Fix Issue 21383 - std.random.uniform!T(urng) when T is dchar disregards urng and always uses a thread-local random

https://github.com/dlang/phobos/pull/7695