Different random shuffles generated when compiled with gdc than with dmd

Andrew Brown via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 30 09:44:31 PDT 2014


GDC version 4.8.2,i guess that's my problem. This is what happens
when you let Ubuntu look after your packages.

Thank you very much!

Andrew

On Friday, 30 May 2014 at 16:13:49 UTC, monarch_dodra wrote:
> On Friday, 30 May 2014 at 13:39:18 UTC, Andrew Brown wrote:
>> Hi there,
>>
>> The following code:
>>
>> void main(){
>>   import std.array : array;
>>   import std.stdio : writeln;
>>   import std.random : rndGen, randomShuffle;
>>   import std.range : iota;
>>
>>   rndGen.seed(12);
>>   int[] temp = iota(10).array;
>>   randomShuffle(temp);
>>   writeln(temp);
>> }
>>
>> writes [1, 8, 4, 2, 0, 7, 5, 6, 9, 3] if it's compiled with 
>> dmd,
>> but [1, 7, 4, 6, 2, 9, 5, 0, 3, 8] with gdc.
>>
>> ...
>>
>> Andrew
>
> Are you sure you are compiling with the same version of dmd and 
> gdc? Fixes were made to the rand.d library in the latest 
> release, which could explain the difference you are observing.


More information about the Digitalmars-d-learn mailing list