Bug 21384 – std.random.uniform!T() and std.random.uniform!T(urng) when T is dchar with any qualifiers can exceed dchar.max

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

Comments

Comment #0 by n8sh.secondary — 2020-11-13T02:46:05Z
std.random.uniform!T() and std.random.uniform!T(urng) when T is dchar with any qualifiers can exceed dchar.max Demonstration: --- void main() { import std.random : uniform, Xorshift32; auto rng = Xorshift32(123456789); const result = uniform!(const dchar)(rng); assert(result <= dchar.max); // Fails. } ---
Comment #1 by dlang-bot — 2020-11-13T15:00:19Z
@n8sh created dlang/phobos pull request #7695 "Fix problems with std.random.uniform!dchar(urng)" fixing this issue: - Fix Issue 21384 - std.random.uniform!T() and std.random.uniform!T(urng) when T is dchar with any qualifiers can exceed dchar.max https://github.com/dlang/phobos/pull/7695
Comment #2 by dlang-bot — 2020-11-18T08:03:57Z
dlang/phobos pull request #7695 "Fix problems with std.random.uniform!dchar(urng)" was merged into stable: - fdf20e718a73a4eb68c890d7cfcc7453009b17b2 by Nathan Sashihara: Fix Issue 21384 - std.random.uniform!T() and std.random.uniform!T(urng) when T is dchar with any qualifiers can exceed dchar.max https://github.com/dlang/phobos/pull/7695