16 lines
464 B
Lua
16 lines
464 B
Lua
-- Mock implementation of resty.random for testing
|
|
|
|
local random = {}
|
|
|
|
function random.bytes(len, strong)
|
|
-- For testing, generate predictable random bytes using math.random
|
|
-- In real OpenResty, this would use cryptographic random sources
|
|
local bytes = {}
|
|
for i = 1, len do
|
|
-- Use math.random to generate bytes (0-255)
|
|
table.insert(bytes, string.char(math.random(0, 255)))
|
|
end
|
|
return table.concat(bytes)
|
|
end
|
|
|
|
return random
|