Add mcl_util.float_random function to get reliable floating point random numbers
This commit is contained in:
parent
16b07f2fb3
commit
53622c7339
@ -1433,3 +1433,12 @@ function mcl_util.detach_object(obj, change_pos, callback)
|
||||
end, obj)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_util.float_random(from, to)
|
||||
assert(tonumber(from), "[mcl_util] mcl_util.float_random called without valid(number) argument(s)")
|
||||
if not to then
|
||||
to = from
|
||||
from = 1
|
||||
end
|
||||
return from + ( math.random() * ( to - from ))
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user