lua-users home
lua-l archive

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


Many thanks for your analysis.


>    - it does not fully eliminate the bias for small numbers that are not a
>    power of two

Yes. I guess that, if you keep generating one random number per
nanosecond, maybe you can feel this bias after two months. But we will
remove it.


> The xorshift128+ RNG produces a sequence whose low-order bits are an LFSR
> sequence. This is a known problem with most pseudo-random number generators
> of this type. It would be better to not use the low-order bit in the way
> 'project' uses them.

We will try to use the higher-bits to generate the number. But two
divisions seem too expensive.


> BTW: the author of the xorshift128+ algorithm now recommends replacing it
> with a slightly different algorithm, which is ever so slightly faster, and
> has better statistical properties. It has some downsides as well, the two
> low-order bits both produce an LFSR sequence, it's probably a wash.
> 
> It's here:
> 
> http://xoroshiro.di.unimi.it/

We know about this, but it uses a rotate operation, which we have to
emulate with 32-bit numbers (for the C-89 version). I am not sure it
is worth the effort. But we can change that.

Anyway, no (P)RNG will be good for everybody (fast, good statistical
properties, really random, unpredictable, repeatable when needed,
jumpable, etc.). If you need anything more specific, you should provide
your own.

(What do you mean by "wash" in your message?)

-- Roberto