lua-users home
lua-l archive

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


Thank you very much for your feedback and the link to those libraries and tools. I will try the math one as well.
Regards


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Luiz Henrique de Figueiredo
Sent: 30 November 2011 13:14
To: Lua mailing list
Subject: Re: statistics in Lua

> 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.