What is the use case of RandomCover?

monarch_dodra monarchdodra at gmail.com
Tue Feb 19 14:18:54 PST 2013


On Tuesday, 19 February 2013 at 21:54:54 UTC, Ivan Kazmenko wrote:
> monarch_dodra wrote:
>> void main()
>> {
>>    uint[5] arr1;
>>    arr1[].fill(rndGen);
>>    uint[5] arr2;
>>    arr2[].fill(rndGen);
>>    writeln("arr1: ", arr1[]);
>>    writeln("arr1: ", arr2[]);
>> }
>> //----
>> arr1: [3622200385, 2579361262, 3208046123, 1753759120, 
>> 133131992]
>> arr2: [3622200385, 2579361262, 3208046123, 1753759120, 
>> 133131992]
>> //----
>> Oops!
>
> Oops indeed!
>
> It should be noted that a common need is to have reproducible 
> RNG routines.  For example, I was angry at Python breaking the 
> reproducibility of everything except the vanilla 
> random.random() around version 3.2.  Still, as the language is 
> going to have random2 anyway, and reproducibility will already 
> suffer much from RNG becoming a reference type, it will be a 
> good time for some cleanup.

In theory, there should be no reproducibility breakage, as the 
generators themselves will not be changed (they are _strictly_ 
modeled after boosts' (the ones we have anyways)). The breakage 
will only occur if the PRNG was being duplicated and generating 
the same sequence twice.

In this case though, one would argue it's not reproducibility 
breakage, but straight up broken code being fixed...


More information about the Digitalmars-d-learn mailing list