Hi all,

The next paragraph gives a bit of context. If you are bored you can
skip it and go directly to the technical question.

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.
Of course, that was because I didn't expose `seed`.
Students were quite disappointed: «but if we want to make games?»,
but I was not since:
1) I knew about the `seed` fix, now in use (like this: `(seed (time))`,
   since my goal is not security);
2) I found it was interesting to be able to check the results of the
3) It is a nice starting point to talk about PRNGs.
It even gave me a related idea (totally not interesting in a non
pedagogical context): let the user choose the sequence of the numbers
that will be «generated». This would be interesting to build exercises,
or for the students to test with a precise sequence.
Something like:
(de my_rand (m n)
# IF a special *list_of_numbers variable has elements
# THEN return the car of *list_of_numbers and circular-shift it
# ELSE return (rand m n)

Now the question. I found discrepancies between PicoLisp:
: (rand 1 1000)
-> 1
: (rand 1 1000)
-> 934
: (bye)

And Ersatz
: (rand 1 1000)
-> 1
: (rand 1 1000)
-> 967
: (bye)

I tried to inspect the source for getting some explanation with no luck.
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.
I'd like to implement this generator for EmuLisp. Any advice ?
Any objection ?



http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to