default random object?
Ary Borenszweig
ary at esperanto.org.ar
Sat Feb 14 07:33:50 PST 2009
Christopher Wright escribió:
> Andrei Alexandrescu wrote:
>> auto rng = Random(unpredictableSeed);
>> auto a = 0.0, b = 1.0;
>> auto x1 = uniform!("[]")(rng, a, b);
>> auto x2 = uniform!("[)")(rng, a, b);
>> auto x3 = uniform!("(]")(rng, a, b);
>> auto x4 = uniform!("()")(rng, a, b);
>
> I always have to look up whether "[]" is exclusive or inclusive. It's
> succinct, but you only have to write code once, and you have to read it
> often.
You can remember "]" is more in touch with the number of the right (the
stick is in full touch with the number) while the ")" only touches the
number in that tiny right bit of the parenthesis. So the "]" includes
it, but the ")" merely touches it but doesn't include it.
At least that's what comes to my mind with those symbols. :-P
More information about the Digitalmars-d
mailing list