Skip to content

Commit

Permalink
Merge pull request #45 from syhily/master
Browse files Browse the repository at this point in the history
#43  using lua-resty-jit-uuid
  • Loading branch information
sumory committed Dec 21, 2016
2 parents f4c94e0 + b04e40a commit 9d5cb81
Show file tree
Hide file tree
Showing 4 changed files with 461 additions and 3 deletions.
24 changes: 24 additions & 0 deletions orange/lib/globalpatches.lua
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

0 comments on commit 9d5cb81

Please sign in to comment.