lua-users home
lua-l archive

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


> It's not impossible that the period will be less than 2^128-1. It
> depends on the specific implementation of the algorithm and on the
> chosen seed value. We already know that there's one
> obviously-degenerate seed: zero. But there may be other seeds that
> have short periods, and if even one such weak seed exists, then even
> the best seed cannot possibly have the full theoretical period.

IIRC, xorshift128+ was carefully designed so that every nonzero seed
has the maximum period of 2^128 - 1

> Ultimately, 128 bits is just way too small of a state vector if you
> need GOOD random numbers. (Mersenne Twister uses something like
> 2.5KB.)

One way I have seen to define PRNG "strength" in the context of non-
cryptographically secure PRNGs is how hard it is to distinguish their
output from true randomness using statistical tests. There are standard
test suites that people use for this such as Diehard or TestU01 and if
you run a state of the art PRNG such as xorshift128+ or pcg-random
through can often end up passing more tests than Mersenne Twister,
despite having a much smaller period.

2^128 is already a really really long period and and going longer than
that doesn't necessarily improve the quality of the RNG.