default random object?
Bill Baxter
wbaxter at gmail.com
Sun Feb 15 11:19:30 PST 2009
On Mon, Feb 16, 2009 at 4:07 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Bill Baxter wrote:
>>
>> On Mon, Feb 16, 2009 at 3:51 AM, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>
>>> auto b = uniform!("[]")(rng, byte.min, byte.max);
>>>
>>> Is this acceptable?
>>
>> If that's what it took I'd probably try this instead:
>> ubyte b = uniform(rng, 0,256);
>>
>> And then add an explicit cast to ubyte if the compiler didn't like that.
>> So no, I don't really think that's good enough. Others may disagree
>> about how important a use case this is, though.
>
> This will indeed work:
>
> ubyte b = cast(ubyte) uniform(rng, 0,256);
>
> I just showed the solution involving no cast. So are you ok with that?
No, but if you are then I'll just make my own 1-liner library
functions, so it's not a big deal.
--bb
More information about the Digitalmars-d
mailing list