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

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-11-13T02:45:19Z
Last change time
2020-11-18T08:03:56Z
Keywords
pull
Assigned to
No Owner
Creator
Nathan S.

Comments

Comment #0 by n8sh.secondary — 2020-11-13T02:45:19Z
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 by dlang-bot — 2020-11-13T15:00:18Z
@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 by dlang-bot — 2020-11-18T08:03:56Z
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