lua-users home
lua-l archive

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


On Thu, Mar 15, 2018 at 7:02 PM, Luiz Henrique de Figueiredo wrote:

Lua 5.4 also has a high-quality math.random function.


 
Internal PRNG in Lua? 
That's nice!
 
Could you please generate time-based seed inside setrandfunc()?
This would help many Lua newbies to use math.random() without knowing the fact that PRNG needs seeding.
Every new run of Lua program (not faster that once per second) will result in new pseudo-random sequence without explicit setting of the seed!
This change will not break anything.
Indeed, the manual never claimed that Lua VM always starts with some fixed value of PRNG seed.