1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-13 19:29:49 +00:00

improve random filename

This commit is contained in:
skywind3000
2018-11-21 20:44:27 +08:00
parent 5fd9f71f7f
commit 333677877a

3
z.lua
View File

@@ -513,6 +513,7 @@ function math.random_init()
if rnd ~= nil then
seed = seed .. rnd
end
seed = seed .. os.tmpname()
local number = 0
for i = 1, seed:len() do
local k = string.byte(seed:sub(i, i))
@@ -612,6 +613,8 @@ function data_save(filename, M)
if rnd ~= nil then
tmpname = tmpname .. '' ..rnd
end
local sub = (os.tmpname()):sub(-6, -1):gsub('[\\/:~]', '')
tmpname = tmpname .. sub
fp = io.open(tmpname, 'w')
end
if fp == nil then