lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2018-03-26 20:34 GMT+02:00 Gé Weijers <ge@weijers.org>:

> The period of the RNG cannot be more than 2^128, because the state is only
> 128 bits.

Way back when Albert first started to post about Lua's random number
generator, I referred to a passage in Knuth's book with a discussion
on, and pseudocode for, a method to increase the period and improve
the statistical properties of any random number generator by
introducing a pseudo-randomly accessed buffer. In typical Lua-L
fashion, my remark was pooh-poohed at the time by people clearly much
better informed than myself, so I dropped out of the discussion.

At the risk of suffering that treatment again, here is the Knuth
reference once more: "Art of Computer Programming", volume 2 (Second
Edition), from p.32, paragraph just above Algorithm B to p.33 just
before Exercises, also Exercise 27 on p.37 and if you need to, its
solution later in the book.