mirror of
https://github.com/nmap/nmap.git
synced 2025-12-12 02:39:03 +00:00
Cache the alpha charset for random_alpha to avoid regenerating it every time.
This commit is contained in:
@@ -79,6 +79,7 @@ function charset(left_bound, right_bound, charset)
|
|||||||
end
|
end
|
||||||
local charset = charset
|
local charset = charset
|
||||||
|
|
||||||
|
local alpha_charset = charset('a', 'z')
|
||||||
--- Generate a random alpha word
|
--- Generate a random alpha word
|
||||||
--
|
--
|
||||||
-- Convenience wrapper around <code>random_string</code> to generate a random
|
-- Convenience wrapper around <code>random_string</code> to generate a random
|
||||||
@@ -86,7 +87,7 @@ local charset = charset
|
|||||||
-- @param len The length of word to return
|
-- @param len The length of word to return
|
||||||
-- @return A string of random characters between 'a' and 'z' inclusive.
|
-- @return A string of random characters between 'a' and 'z' inclusive.
|
||||||
function random_alpha (len)
|
function random_alpha (len)
|
||||||
return random_string(len, charset('a', 'z'))
|
return random_string(len, alpha_charset)
|
||||||
end
|
end
|
||||||
|
|
||||||
return _ENV
|
return _ENV
|
||||||
|
|||||||
Reference in New Issue
Block a user