Module:Sandbox/RexxS/Random

local p = {}

-- This returns a pseudo-random integer in the range [m, n] where n>m swap them p.random_num = function(frame) local m = tonumber( mw.text.trim(frame.args[1]) ) or 0 local n = tonumber( mw.text.trim(frame.args[2]) ) or 9 local randnum = 0 math.randomseed( os.time ) if m<n then randnum = math.random( m, n ) else randnum = math.random( n, m ) end return randnum end

p.randomIP = function math.randomseed( os.time ) local ip1 = math.random( 0, 255 ) local ip2 = math.random( 0, 255 ) local ip3 = math.random( 0, 255 ) local ip4 = math.random( 0, 255 ) local ip = ip1 .. "." .. ip2 .. "." .. ip3 .. "." .. ip4 return ip end

p.testor = function(frame) local n = tonumber( frame.args[1] ) or 99 return n end

return p