-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from syhily/master
#43 using lua-resty-jit-uuid
- Loading branch information
Showing
4 changed files
with
461 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
-- Override global(_G) namepace, inspired by kong | ||
-- | ||
return function(opts) | ||
-- For further setting | ||
opts = opts or {} | ||
|
||
-- Add a special randomseed for math, no arguments | ||
do | ||
local util = require "orange.utils.utils" | ||
local randomseed = math.randomseed | ||
local seed | ||
|
||
_G.math.randomseed = function() | ||
if not seed then | ||
seed = util.get_random_seed() | ||
else | ||
ngx.log(ngx.ERR, "The seed random number generator seed has already seeded with: " .. seed .. "\n") | ||
end | ||
randomseed(seed) | ||
return seed | ||
end | ||
end | ||
end |
Oops, something went wrong.