Different random shuffles generated when compiled with gdc than with dmd
Joseph Rushton Wakeling via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 31 13:37:01 PDT 2014
On 30/05/14 22:45, monarch_dodra via Digitalmars-d-learn wrote:
> Didn't you make changes to how and when the global PRNG is popped and accessed
> in randomShuffle? I figured it *could* be an explanation.
No, it was partialShuffle that I tweaked, and that shouldn't affect the results
here. There was a bug where partialShuffle would _always_ shuffle the whole of
the input; but that wouldn't affect the results of randomShuffle itself, which
calls partialShuffle with the explicit request to shuffle the entire array.
Just to be sure I checked with random/partialShuffle pre- and post- my patches,
and the result is identical: [1, 8, 4, 2, 0, 7, 5, 6, 9, 3] just as the OP gets
for dmd.
I think it's more likely that the culprit is either your set of patches to the
Mersenne Twister, or the patches made to uniform() (which is called by
partialShuffle). I'll look more deeply into this.
More information about the Digitalmars-d-learn
mailing list