added seed() fn, corrected err with local math_random

This commit is contained in:
Paul Liverman III
2018-04-23 02:40:21 -07:00
parent 0eccde530a
commit fb7b826942
2 changed files with 12 additions and 1 deletions

View File

@@ -32,7 +32,8 @@ local math_ceil = math.ceil
local math_atan2 = math.atan2 or math.atan
local math_sqrt = math.sqrt
local math_abs = math.abs
local math_random = love and love.math or math.random
local math_random = love and love.math and love.math.random or math.random
local math_randomseed = love and love.math and love.math.setRandomSeed or math.randomseed
local noop = function()
end
@@ -131,6 +132,11 @@ function lume.vector(angle, magnitude)
end
function lume.seed(low, high)
return math_randomseed(low, high)
end
function lume.random(a, b)
if not a then a, b = 0, 1 end
if not b then b = 0 end