Ranges and random numbers -- again

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Jun 17 15:57:30 PDT 2013


On 06/17/2013 09:36 PM, monarch_dodra wrote:
> Being able to *save* a random range (which your proposal would prevent) can have
> useful applications too. It means you can iterate on the same random number
> sequence several times, lazily, without having to store the results in a buffer.

One further remark on this.  I agree that it would be nice to be able to .save
where possible -- that is, if one has a pseudo-random number sequence one should
be able to save, and only if the source of randomness is "truly" random should
the adapter range be an InputRange rather than ForwardRange.

I concluded that this wasn't feasible more out of despair than desire, because I
felt that deterministic, .save-able behaviour had its own traps that were
potentially severe, because they would involve generating unintended statistical
correlations that the user probably wouldn't notice.



More information about the Digitalmars-d mailing list