lua-users home
lua-l archive

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


> Does anybody know any ready codes for statistical functions in Lua, random generation, ...?

For random number generation using the uniform distribution Lua has a
built-in function math.random. See also math.randomseed.

Lua's math.random uses the random number generator provided by the C library.
Historically, this generator was not very good, but in recent C libraries,
e.g. the GNU C library, this generator is much better. If you need to
make sure you're using a better random number generator, try my lrandom
at http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lrandom which uses the
Mersenne Twister.