Skip to content

Commit

Permalink
util should seed rng only once
Browse files Browse the repository at this point in the history
  • Loading branch information
cryi committed Sep 29, 2024
1 parent cca69d1 commit 57a7ad2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config.hjson
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
version: 0.34.3
version: 0.34.4
global_modules: false //disables global modules loading (only looks up for modules in cwd)
minify: true
compress: true
Expand Down
6 changes: 4 additions & 2 deletions lib/eli/util.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local util = {}

math.randomseed(os.time())

function util.is_array(t)
if type(t) ~= "table" then
return false
Expand Down Expand Up @@ -296,7 +298,7 @@ function util.random_string(length, charset)
if not length or length <= 0 then
return ""
end
math.randomseed(os.time())

return util.random_string(length - 1) .. charset[math.random(1, #charset)]
end

Expand Down Expand Up @@ -373,7 +375,7 @@ function util.extract_error_info(errorMessage)
if message and code then
return message, tonumber(code) -- Convert code to a number
else
return errorMessage, nil -- If pattern doesn't match, return the whole message and nil for the code
return errorMessage, nil -- If pattern doesn't match, return the whole message and nil for the code
end
end

Expand Down

0 comments on commit 57a7ad2

Please sign in to comment.