default random object?

Steve Schveighoffer schveiguy at yahoo.com
Sat Feb 14 15:00:07 PST 2009


On Sat, 14 Feb 2009 14:11:10 +0300, Denis Koroskin wrote:

> On Sat, 14 Feb 2009 14:04:36 +0300, Walter Bright
> <newshound1 at digitalmars.com> wrote:
> 
>> Andrei Alexandrescu wrote:
>>> auto big = uniform(rng, uint.max / 2, uint.max);
>>>  If the interval is open I can't generate uint.max.
>>
>>
>> auto big = uniform(rng, uint.max / 2 - 1, uint.max) + 1;
> 
> Yeah, but now about uniform(uint.min, uint.max)?

I think we're working under the assumption that the uniform function is 
based on some function that returns a random int or uint, no?  So just 
call the base function.

-Steve



More information about the Digitalmars-d mailing list