Changes between Version 2 and Version 3 of StdLib/MathLib
- Timestamp:
- 12/21/07 17:52:24 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
StdLib/MathLib
v2 v3 122 122 123 123 Returns a random integer. If no parameters are given, the value will be a random integer in the range [-2^31^, 2^31^). If one parameter is given, it will act as the upper noninclusive bound on the values returned, so `math.rand(10)` will return integers in the range [0, 10). Passing a single negative number, such as `math.rand(-10)` won't work properly; instead use `-math.rand(10)` to get numbers in the range (-10, 0]. If two parameters are given, the first is the lower inclusive bound, and the second is the upper noninclusive bound. So `math.rand(-10, -5)` will return numbers in the range [-10, -5). 124 125 == '''`math.frand([[lo,] hi])`''' == 126 127 Returns a random float. If no parameters are given, the value will be a random float in the range [0.0, 1.0]. If one parameter is given, it will act as the upper inclusive bound on the values returned, so `math.frand(10)` will return floats in the range [0.0, 10.0]. Passing a single negative number, such as `math.frand(-10)` will work properly and will give numbers in the range [-10.0, 0.0]. If two parameters are given, the first is the lower bound and the second the upper, both inclusive. So `math.frand(-10, -5)` will return numbers in the range [-10.0, -5.0].