Difference between revisions of "Math.random"
From OpenEUO
(Created page with " math.random ([m [, n]]) This function is an interface to the simple pseudo-random generator function rand provided by ANSI C. (No guarantees can be given for its statistical pr...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 5: | Line 5: | ||
When called without arguments, returns a uniform pseudo-random real number in the range [0,1). When called with an integer number m, math.random returns a uniform pseudo-random integer in the range [1, m]. When called with two integer numbers m and n, math.random returns a uniform pseudo-random integer in the range [m, n]. | When called without arguments, returns a uniform pseudo-random real number in the range [0,1). When called with an integer number m, math.random returns a uniform pseudo-random integer in the range [1, m]. When called with two integer numbers m and n, math.random returns a uniform pseudo-random integer in the range [m, n]. | ||
− | Note: C rand is a horrid generator. If | + | Note: C rand is a horrid generator. If the lua.dll based on LuaJIT is available, you'll get a much improved random number generator. |
+ | |||
+ | [[Math.randomseed]] |
Latest revision as of 11:10, 9 October 2010
math.random ([m [, n]])
This function is an interface to the simple pseudo-random generator function rand provided by ANSI C. (No guarantees can be given for its statistical properties.)
When called without arguments, returns a uniform pseudo-random real number in the range [0,1). When called with an integer number m, math.random returns a uniform pseudo-random integer in the range [1, m]. When called with two integer numbers m and n, math.random returns a uniform pseudo-random integer in the range [m, n].
Note: C rand is a horrid generator. If the lua.dll based on LuaJIT is available, you'll get a much improved random number generator.