I’m writing some code but this specific piece randomly works, and randomly does not work. Any Ideas why?
do
local rtick = tick()%1 -- my pseudo-seed (by join-tick offset)
function _p.random(x, y)
local r = (math.random()+rtick)%1
if x and y then
return math.floor(x + (y+1-x)*r)
elseif x then
return math.floor(1 + x*r)
end
return r
end
function _p.random2(x, y)
local r = (math.random()-rtick+1)%1
if x and y then
return math.floor(x + (y+1-x)*r)
elseif x then
return math.floor(1 + x*r)
end
return r
end
end