Hi Christophe,
our mails overlapped :)

## Advertising

> PicoLisp was not the Haynes one, but the one referred as «Newlib» here:
> http://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
Right. I took it originally from the book by Donald Knuth.
> Maybe I was too tired. The difference is 33, and we see in the Ersatz src:
> n = (int)(Seed >>> 33) % n;
Right.
> What I don't understand is why Ersatz shifts by 33, and PicoLisp by BITS,
> (which should IMHO be 32).
True. In fact, as I wrote, I don't remember that either. Perhaps a sign
issue? Would it make sense to change it? Should be well tested though.
This connects to my next remarks/questions:
> * The Wikipedia page mentions taking «bits 63...32». I guess that
> they start at bit 0, thus should the shift be 32 ?
Knuth writes that the highest bits are more random than the lower bits
in a linear congruential generator.
> * Is 33 used because of the sign bit ?
Yes, perhaps.
> * In the PicoLisp src, why use LL and not ULL to define
> 6364136223846793005?
: (hex 6364136223846793005)
-> "5851F42D4C957F2D"
As you see, this number doesn't have its sign bit set in 64-bit
two-complement representation (it would be 8 or higher in its most
siginificant digit). So "unsigned" makes no difference.
♪♫ Alex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe