lua-users home
lua-l archive

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


> On May 8, 2018, at 5:06 AM, Sergey Rozhenko <sergroj@gmail.com> wrote:
> What about LuaJIT's PRNG? Having the same PRNG would be good for compatibility.

Compatibility with LuaJIT ?
Should it be the other way around ?

> "LuaJIT uses a Tausworthe PRNG with period 2^223 to implement math.random() and math.randomseed()."

Tausworthe PRNG is old (1991), and will fail linearity test.
(It look like xorshift+ without the plus "scrambler")

LuaJIT's implementation also have problem with range bias.
(It just use 52 bit random float to calculate math.random(n,m))

https://github.com/aerospike/luajit/blob/master/src/lib_math.c