diff --git a/.luacheckrc b/.luacheckrc index 1e5df27..a88280a 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -4,6 +4,7 @@ return { "211", -- Unused local variable. "212/self", -- Unused argument self. "213", -- Unused loop variable. + "214", -- used _ prefix variable (we use this often to indicate private variables, not unused) "631", -- Line is too long. }, files = { diff --git a/mathx.lua b/mathx.lua index 7afbbcc..502db21 100644 --- a/mathx.lua +++ b/mathx.lua @@ -126,20 +126,20 @@ end --todo: more easings - back, bounce, elastic --(internal; use a provided random generator object, or not) -local function _random(_r, ...) - if _r then return _r:random(...) end +local function _random(rng, ...) + if rng then return rng:random(...) end if love then return love.math.random(...) end return math.random(...) end --return a random sign -function mathx.random_sign(_r) - return _random(_r) < 0.5 and -1 or 1 +function mathx.random_sign(rng) + return _random(rng) < 0.5 and -1 or 1 end --return a random value between two numbers (continuous) -function mathx.random_lerp(min, max, _r) - return mathx.lerp(min, max, _random(_r)) +function mathx.random_lerp(min, max, rng) + return mathx.lerp(min, max, _random(rng)) end --nan checking