More languages
More actions
mNo edit summary |
m (Second attempt at pseudo-random) |
||
Line 4: | Line 4: | ||
local parent = frame:getParent() | local parent = frame:getParent() | ||
local a = parent.args[1] | local a = parent.args[1] or 1 | ||
local b = parent.args[2] or 100 | local b = parent.args[2] or 100 | ||
local | local Date = os.date() | ||
return | local h = Date:match("(%d+):%d+:%d+") | ||
local m = Date:match("%d+:(%d+):%d+") | |||
local s = Date:match("%d+:%d+:(%d+)") | |||
local rnd = s * s * math.random(1,10000) | |||
while (rnd > b) do | |||
rnd = math.floor(rnd/2) | |||
end | |||
while (rnd < a) do | |||
rnd = math.floor(rnd*1.5) | |||
end | |||
return rnd | |||
end | end | ||
return p | return p |
Revision as of 23:30, 5 October 2022
local p = {}
function p.random(frame)
local parent = frame:getParent()
local a = parent.args[1] or 1
local b = parent.args[2] or 100
local Date = os.date()
local h = Date:match("(%d+):%d+:%d+")
local m = Date:match("%d+:(%d+):%d+")
local s = Date:match("%d+:%d+:(%d+)")
local rnd = s * s * math.random(1,10000)
while (rnd > b) do
rnd = math.floor(rnd/2)
end
while (rnd < a) do
rnd = math.floor(rnd*1.5)
end
return rnd
end
return p