Mix more randomness into key codes
Continuously using math.random should tap into the unpredictable usages of other mods. I limited the number at 2^15-1 to make sure the call works with Lua 5.1 when INT_MAX is 2^15-1.
This commit is contained in:
parent
3640844c1f
commit
29d7fecd4b
3
lock.lua
3
lock.lua
@ -39,7 +39,8 @@ local exports = {}
|
||||
local function get_next_lock_id()
|
||||
-- Generate 64 random bits and encode them in hexadecimal:
|
||||
return string.format("%08x%08x",
|
||||
rng:next() + 2147483648, rng:next() + 2147483648)
|
||||
rng:next() + 2147483648,
|
||||
rng:next(0, 131071) * 32768 + math.random(0, 32767))
|
||||
end
|
||||
|
||||
-- Returns whether the named player is an admin of the node owned as given.
|
||||
|
Loading…
x
Reference in New Issue
Block a user