lua-users home
lua-l archive

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


On Mar 27, 2018, at 1:55 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:

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.

Long period does not imply good quality: 

http://xoroshiro.di.unimi.it/, see section Remarks

More state bits does not imply good quality:

Table just above Remarks: SplitMix64 had only 64 state bits,
but it produce better random numbers than Mersenne Twister.

Shuffling does not imply good quality: (quoted from Knuth AoCP):

Shuffling methods have an in inherit defect, however, they change only 
the orders of the generated numbers, not the numbers themselves.

IIRC, your pseudocode build random double by jamming 2 rand() bits.
If the random numbers is not very good, shuffling does not help much.

---

Here is M.E O'Neil PCG paper 9/5/14, and her comment on KnuthB :
http://www.pcg-random.org/pdf/hmc-cs-2014-0905.pdf, page 10

KnuthB [20, 3], one of the algorithms mandated by the C++11 standard library, taken from the previous edition of Knuth’s Art of Computer Programming (but removed from the current edition [21]) is particularly disappointing; we had already seen that it is slow, and it fails many statistical tests, but now we see that it is also huge.