[Issue 15147] std.random.uniform return value depends on integer size

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 10 05:55:50 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=15147

--- Comment #2 from Jon Degenhardt <jrdemail2000-dlang at yahoo.com> ---
I'm interested in this, as I use these properties extensively for unit tests in
randomization routines. Is it also a capability intended to be supported by
some of my tools.

The formulation of the unit tests added as part of
https://github.com/dlang/phobos/pull/6393 raised a couple questions for me.
Those unit tests are qualified as follows:

version(X86_64) // Issue 15147
assert([0, 1, 2, 4, 5].randomShuffle(rnd2).equal([2, 0, 4, 5, 1]));

My questions:
* Is the lack of consistency strictly related to integer size (e.g. 32-bit vs
64-bit), or can these differences surface between different platforms even with
the same integer size?
* For routines like std.random.randomShuffle and std.random.randomCover, is the
issue that these are passing the range length, normally size_t, to
std.random.uniform et.al. The issue being that the size of size_t is platform
specific?

--


More information about the Digitalmars-d-bugs mailing list