Skip to content

Commit 5597701

Browse files
authored
Update randomStrings.lua
minor performance Improvement using utils.
1 parent fbd2f06 commit 5597701

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/prometheus/randomStrings.lua

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
local Ast = require("prometheus.ast");
2-
3-
local charset = {}
4-
5-
-- qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890
6-
for i = 48, 57 do table.insert(charset, string.char(i)) end
7-
for i = 65, 90 do table.insert(charset, string.char(i)) end
8-
for i = 97, 122 do table.insert(charset, string.char(i)) end
1+
local Ast, utils = require("prometheus.ast"), require("prometheus.util");
2+
local charset = utils.chararray("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890")
93

104
local function randomString(wordsOrLen)
115
if type(wordsOrLen) == "table" then
@@ -27,4 +21,4 @@ end
2721
return {
2822
randomString = randomString,
2923
randomStringNode = randomStringNode,
30-
}
24+
}

0 commit comments

Comments
 (0)