Range of random numbers
bearophile
bearophileHUGS at lycos.com
Tue Apr 24 06:52:51 PDT 2012
travert at phare.normalesup.org:
> That looks like a workarround, not meaningful code.
It wasn't terrible code :-)
> How about
> return repeat(_ =>uniform(lower, upper)).map!(x => x())();
> ?
Why don't you write a little benchmark to compare the performance
of the two versions?
Using uniform(lower, upper, gen) with
auto gen = Xorshift(1);
to reduce influence from the random generator.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list