1
0
mirror of https://github.com/kepler155c/opus synced 2024-12-26 00:20:26 +00:00

Merge pull request #5 from sorucoder/develop-1.8

Removed util.random, added util.randomFloat
This commit is contained in:
kepler155c 2018-12-09 15:43:26 -05:00 committed by GitHub
commit a6c8ecccd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,12 +132,13 @@ end
-- http://lua-users.org/wiki/SimpleRound
function Util.round(num, idp)
local mult = 10^(idp or 0)
return util.signum(num) * math.floor(math.abs(num) * mult + 0.5) / mult
return Util.signum(num) * math.floor(math.abs(num) * mult + 0.5) / mult
end
function Util.random(max, min)
function Util.randomFloat(max, min)
min = min or 0
return math.random(0, max-min) + min
max = max or 1
return (max-min) * math.random() + min
end
--[[ Table functions ]] --