Ranges and random numbers -- again
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Mon Jun 17 16:21:03 PDT 2013
On 06/17/2013 11:36 PM, monarch_dodra wrote:
> I could even add:
>
> SomeRandomForwardRange r;
> auto arr1 = array(r.save);
> auto arr2 = array(r);
> assert(x == y); // This time both are the same
Try:
auto gen2 = new MtClass19937(unpredictableSeed);
/* the above is just MersenneTwister tweaked to be
* a final class, hence reference type
*/
auto r5 = simpleRandomRange(0.0L, 1.0L, gen2);
auto arr1 = array(r5.save.take(5));
auto arr2 = array(r5.take(5));
writeln(arr1);
writeln(arr2);
... and you get two different sequences of numbers.
More information about the Digitalmars-d
mailing list