lua-users home
lua-l archive

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

2018-05-08 12:49 GMT-03:00 Roberto Ierusalimschy <>:
> On Пн 07.05.18 20:19, Roberto Ierusalimschy wrote:
> >What is present today in the latest release of Lua is 'rand'/'random',
> >not xorshift128plus.
> What about LuaJIT's PRNG? Having the same PRNG would be good for
> compatibility.
> "LuaJIT uses a Tausworthe PRNG with period 2^223 to implement
> math.random() and math.randomseed()."

I am no expert about PRNG, but according to some experts (the guys
who created xoroshiro, xorshift, etc.), "Our main 64-bit proposal for
an all-purpose, rock-solid generator is xoshiro256**". Moreover, it has a
quite simple implementation. What would be the "credentials" for

Do you have the code for this generator? Does it generate 64-bit numbers?
Is it easy to implement it even if the compiler does not support 64-bit

-- Roberto

Just an update of a real-world application. I'm working on a scientific stochastic code that "can" use the default PRNG of luajit and lua-5.4.0-work1 (don't worry!). Compared to luajit, lua-5.4.0-work1 exhibits a higher convergence rate, which is a symptom of a (maybe) better PRNG. Moreover,  luajit is "only" 60% faster (no I/O bound) than lua-5.4.0-work1, which makes me think about forgetting luajit forever.

Many thanks,
Rodrigo Azevedo Moreira da Silva