Range of random numbers

bearophile bearophileHUGS at lycos.com
Mon Apr 23 09:56:47 PDT 2012


jerro:

> return repeat(0).map!(_ => uniform(lower, upper))();
> 
> repeat(0) returns the same sequence as cycle([0]) and is as fast
> as it gets, since popFront does nothing and empty is an enum.

Good idea.

-------------------

Dmitry Olshansky:

> What's wrong with:
> http://dlang.org/phobos/std_algorithm.html#count

It's for a different purpose. So the count() I was proposing will need a different name.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list