D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21384 - std.random.uniform!T() and std.random.uniform!T(urng) when T is dchar with any qualifiers can exceed dchar.max
Summary: std.random.uniform!T() and std.random.uniform!T(urng) when T is dchar with an...
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:46 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:46:05 UTC
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 Dlang Bot 2020-11-13 15:00:19 UTC
@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 Dlang Bot 2020-11-18 08:03:57 UTC
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