forked from izaya/LuPPC
11 lines
286 B
Lua
11 lines
286 B
Lua
|
local random = {}
|
||
|
|
||
|
function random.uuid()
|
||
|
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
||
|
return string.gsub(template, '[xy]', function (c)
|
||
|
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
|
||
|
return string.format('%x', v)
|
||
|
end)
|
||
|
end
|
||
|
|
||
|
return random
|