Changed lume.uuid() to use local math_random()

This commit is contained in:
rxi 2014-04-05 23:08:03 +01:00
parent bb56f1ce3a
commit c7471b32fb

View File

@ -362,11 +362,10 @@ end
function lume.uuid() function lume.uuid()
local hex = "0123456789abcdef"
local fn = function(x) local fn = function(x)
local r = math.random(16) - 1 local r = math_random(16) - 1
r = (x == "x") and (r + 1) or (r % 4) + 9 r = (x == "x") and (r + 1) or (r % 4) + 9
return hex:sub(r, r) return ("0123456789abcdef"):sub(r, r)
end end
return (("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"):gsub("[xy]", fn)) return (("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"):gsub("[xy]", fn))
end end