Hi Henrik,

> od -vAn -N8 -tu8 /dev/urandom should eliminate the trap of not generating a
> random seed?

You don't need to call 'od' for that. Simply do

   : (in "/dev/urandom" (rd 20))
   -> 384093524694620556071320789767590963480707536932

In praxis, (rd 8) or (rd 12) should be enough, I think:

   (seed (in "/dev/urandom" (rd 8)))


> And then I hope rand generates a sequence with a very big period.

The period of the built-in PicoLisp random generator doesn't depend on
the seed at all. The seed just gives the initial value.

PicoLisp comes with a 64-bit linear congruential random generator (also
in pil32) with the multiplier 6364136223846793005. According to Knuth's
Art of Computer Programming (Vol. 2, Seminumerical Algorithms), this
gives a period of 2 ** 64.


> Put together I should have truly random situation in the sense that I avoid
> flaw #3 and #4 as described here:
> http://www.lauradhamilton.com/random-lessons-online-poker-exploit or?

If you want almost truely random numbers, you ideally call /dev/random
each time (though it is slower than the built-in generator), e.g.

   (in "dev/random" (rd 3))

if 24-bit numbers are enough. Note, however, that /dev/random blocks if
the pool is exhausted, and waits for events to refill it. So typically
you would stay with /dev/urandom.

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

Reply via email to