Open rfl890 opened 11 months ago
I like the addition, but I think we should revise the lib to make the input-stream pluggable.
It would mean getting rid of all the seeding, and implementing multiple streams; the current ones and your new one. That will make the user responsible to ensure proper quality randomness for whatever his/her goal is. So they could choose, plain Lua random, or more advanced versions.
And fwiw; we should not set a default. Because the arguments made by @daurnimator are valid imho. So whatever the user chooses must be their deliberate choice.
I have implemented an SHA-256 based RNG in pure Lua. It provides more security than the built-in math.random, and allows for more complex seeding methods. Due to this, one of the changes implements deriving seeds from the
tostring
of a blank table, which will be unique on each run for systems that have ASLR enabled. Also, seeding the PRNG can now be done with any binary data.Let me know what you think and if it's too overkill.