On Thursday, 14 June 2012 at 23:32:41 UTC, Jonathan M Davis wrote:
I'm not talking about passing them as refs. I'm talking about making them reference types. It arguably makes no sense for random number generators to be passed around by value. It makes it ludicrously easy to get the same value
multiple times simply because you passed it around.

I didn't have time to look at the specific issue with RandomSample yet, but I can confirm that the implications of the current RNG-as-a-value design were surprising for me as well when I first used std.random – I see the point in avoiding heap allocations whenever possible, though.

David

Reply via email to