Hi Christophe,

> Alex, if nobody in the mailing list is against modifying the rand of
> Ersatz, may I humbly ask you to use >>>32 instead of >>>33 ?

Sorry, I think this is not a good idea. Now I remembered why the shift
is 33 and not 32:

It has to do with the fact that Java doesn't support unsigned 32-it

But in 'rand', the line

   n = (int)(Seed >>> 33) % n;

requires the result of the shift operation to be a positive number.

Fortunately, Java has with '>>>' a shift operation which inserts zero
bits from the right (i.e. an unsigned shift), thus guaranteeing a
positive result. A shift of 32 bits, however, would not suffice, because
it would put the sign bit of the original 64-bit number into the MSB of
the result.

♪♫ Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to