Re: [AD] rand() vs random()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sunday 25 May 2003 8:17 pm, Sven Sandberg wrote:
> Then (rand()+(rand()>>16)) should work for you too? I'd vote for that,
> as it works both on platforms where the most random bits are in high 16
> and in low 16 bits, as well as on platforms with only 15 bit random
> numbers.

Beware of overflow. 0x7FFFFFFF + (0x10000 >> 16) == 0x80000000 which is 
negative.

Ben





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/