This is correct for the standard Lua interpreter [0].
LuaJIT bundles its own Tausworthe PRNG [1].
————
0. http://www.lua.org/manual/5.2/manual.html#pdf-math.random
I've noticed that Ruby's RNG is not that great. I've got a couple of small IRC bot scripts, one is a dice roller, the other is one that takes random items from a Google spreadsheet (using simple Random#rand in the first case, and Array#sample in the second).
The dice seems biased to certain numbers, and the spreadsheet has the same items come up more than mundane statistics would otherwise suggest. (A 1/50 roll landing on the same item 2-3 times in a row, multiple times per day?)
It's gotten to the point where my users don't want to use my bot for RPGs. I'll have to see if using SecureRandom#random_number produces any different results
Also MT still has to be seeded, it is not crypto-safe and its quality/computational load ratio is not too good.
It's far more complex than it needs to be. If you want a fast, high quality deterministic RNG, use something from the xorshift family.
Re:Random in the wild
by edwintorok on Tuesday December 09, 2014 @01:51PM
(#8724782)
This is a good article describing fast non-cryptographic RNGs:
http://www.drdobbs.com/tools/fast-high-quality-parallel-rand...
http://www.drdobbs.com/tools/fast-high-quality-parallel-rand...
CMRES is quite impressive, I get ~1500 MB/s out of it. Quite useful for generating large unique files for various testcases.
As far as I know, Lua does not include Mersenne Twister. math.random() is just C rand().