Open dlangBugzillaToGithub opened 9 years ago
I just ran into this when trying to add more/better public examples for std.random (https://github.com/dlang/phobos/pull/6393).
Normally, examples can be done by seeding the RNG and thus _knowing_ the sequence of the PRNG.
The current behavior is really nasty.
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?
dlang-bugzilla (@CyberShadow) reported this on 2015-10-03T18:25:09Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=15147
CC List
Description