Thread overview | |||||
---|---|---|---|---|---|
|
June 08, 2014 [Issue 12877] std.random.uniform cannot handle dchar variates | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12877 --- Comment #1 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> --- Fix submitted: https://github.com/D-Programming-Language/phobos/pull/2235 -- |
June 10, 2014 [Issue 12877] std.random.uniform cannot handle dchar variates | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12877 github-bugzilla@puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED -- |
June 10, 2014 [Issue 12877] std.random.uniform cannot handle dchar variates | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12877 --- Comment #2 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/cb5ee35ad69024293d5d557151e5939065fa0a06 Fix Issue #12877: allow uniform() to handle dchar variates Since [dchar.min, dchar.max] does not cover the full bit range of dchar, optimizations that work for other integral types will fail here, and result in illegal unicode points being generated. This fix avoids breaking any existing calls to uniform() via a twofold approach: * uniform!"[]"(T.min, T.max) will only call uniform!ResultType if T is not a dchar; * uniform!dchar will not try and use the entire bit range but will instead call uniform!"[]"(dchar.min, dchar.max). Unittests have been added that should prevent such issues from arising again. https://github.com/D-Programming-Language/phobos/commit/240a11ebe31ca9980d951553c2dac3fd62070b56 Merge pull request #2235 from WebDrake/uniform-dchar Fix Issue #12877: allow uniform() to handle dchar variates -- |
Copyright © 1999-2021 by the D Language Foundation