Ranges and random numbers -- again
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Jun 18 07:39:38 PDT 2013
On 6/18/13 10:16 AM, H. S. Teoh wrote:
> I say again that RNGs being passed by value is a major BUG. The above
> situation is a prime example of this problem. We *need* to make RNGs
> passed by reference. For situations where you *want* to duplicate a
> pseudo random sequence, an explicit method should be provided to clone
> the RNG. Duplication of RNGs should never be implicit.
Occasionally copying a RNG's state is useful, but I agree most of the
time you want to just take a reference to it.
I think a good way toward a solution is
http://d.puremagic.com/issues/show_bug.cgi?id=10404.
Andrei
More information about the Digitalmars-d
mailing list