You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lua's random isn't that good, it's just a wrapper around C's rand, which can change by platform, and isn't exactly awesome. (Not recommended for use on macOS and FreeBSD).
We could use a do-block to implement a random generator that hides it's seed without having to be OO.
An LCG would be easiest to implement, though Lua 5.1/5.2 would be a bit harder for that.
The Mersenne Twister is a tad better than an LCG, but other Lua implementations have found not using C, and using pure Lua is very slow, which wouldn't be acceptable. (Especially as you can't make SIMD-Mersenne-Twister in pure Lua.)
ChaCha20 is crytographically secure, so much better than others, and there is a pure Lua implementation, but it is quite sizeable to implement considering the size of f.lua so far, and I don't have the expertise to confirm if it is working beyond "seemingly random".
I think the best bet is an LCG, specifically Multiply-With-Carry (MWC), which is the same as FreeBSD libc rand.
The text was updated successfully, but these errors were encountered:
Lua's random isn't that good, it's just a wrapper around C's rand, which can change by platform, and isn't exactly awesome. (Not recommended for use on macOS and FreeBSD).
We could use a do-block to implement a random generator that hides it's seed without having to be OO.
An LCG would be easiest to implement, though Lua 5.1/5.2 would be a bit harder for that.
The Mersenne Twister is a tad better than an LCG, but other Lua implementations have found not using C, and using pure Lua is very slow, which wouldn't be acceptable. (Especially as you can't make SIMD-Mersenne-Twister in pure Lua.)
ChaCha20 is crytographically secure, so much better than others, and there is a pure Lua implementation, but it is quite sizeable to implement considering the size of f.lua so far, and I don't have the expertise to confirm if it is working beyond "seemingly random".
I think the best bet is an LCG, specifically Multiply-With-Carry (MWC), which is the same as FreeBSD libc rand.
The text was updated successfully, but these errors were encountered: