Hi Christophe,

> I use PicoLisp to implement a pedagogical language, directly
> embedded in PicoLisp. In an exercise about dices, I noticed a
> kind of similarity among the results of my students.
> ...

Nice! This sounds really interesting.


> Now the question. I found discrepancies between PicoLisp:
> ...
> -> 934

> And Ersatz
> ...
> -> 967

Right. In fact, three of the four implementations (pil64, pil32, mini
and ersatz) will give different results. Only mini and pil32 behave
identically.


> Is there a reason for those different behaviours ?
> 
> Last thing (mostly for Jon), I read that the PicoLisp generator is
> a 64-bit linear congruential random generator (both pil64 and pil32)
> with the multiplier 6364136223846793005.

That's correct. All four basically do

   Seed = Seed * 6364136223846793005 + 1

The differences arise from how the Seed is reduced to a 32-bit number
after that.

pil64 uses the middle 64 bits of the 128-bit result of the
multiplication, while pil32 and mini use the highest 32 bits of the
64-bit result. Ersatz does similar to pil32 (i.e. a 64-bit result), but
shifts by 33 (I don't know if there was a special reason).

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

Reply via email to