On 13/06/12 03:15, jerro wrote:
Yes, I'll agree with you. But I don't know about others. It'll be nice
if others share their opinion such that your efforts won't be wasted.
That code was mostly written by Andrei and David.
Jens
I, for one, agree that this:
auto randomSample(R, Random)(R r, size_t n, Random gen =
Random(unpredictableSeed))
is the best way to solve this. The current implementation where
Random can be void and then RandomSample uses the global rng and
everything behaves slightly differently just seems like an endless
source of bugs.
I've filed a bug report relating to this.
http://d.puremagic.com/issues/show_bug.cgi?id=8247
Assuming API changes are permissible (a big IF), I think the way to do it might
be something like
auto randomSample(R, UniformRNG = Random, seed)(R r, size_t n, seed s =
unpredictableSeed)
... meaning that the user has an option to specify an RNG _type_ without
specifying a seed, and that the seed can be either unpredictable or specific.
The user could also not specify a RNG type, in which case the default RNG type
would be used, but would be seeded unpredictably.