lua-users home
lua-l archive

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


Shawn Fox wrote:
> I  prefer to replace rand() with a custom PRNG as LuaJIT 2.0 does, but I do
> think that the generator should be seeded using /dev/urandom with a fall
> back to using time(NULL) if /dev/urandom does not exist.

Seeding from an external source is an orthogonal concern. I think
this is out of scope for integration into the standard library.
Some users may even prefer the deterministic initial seed.

Programs in need of some (weak) initial randomness might get away
with 'math.randomseed(os.time())'. I think there are various
crypto modules for Lua which offer stronger initial PRNG seeding
(this is hard to get right).

--Mike