VOOZH about

URL: https://minecraft.wiki/w/Module:Random

⇱ Module:Random – Minecraft Wiki


Module:Random

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[view] [edit] [history] [purge]Jump to code ↴

This module generates a pseudo-random number. It is used the same as math.random, however it first sets up a seed so that the number is actually random.

[view] [edit] [history] [purge]The above documentation is transcluded from Module:Random/doc.
localp={}
localseeded
localrandomseed=math.randomseed
localrandom=math.random
functionp.random(m,n)
ifnotseededthen
p.seed()
end
returnrandom(nandmormand1or0,normor1)
end
functionp.seed(seed)
randomseed(seedor(os.time()+os.clock()*1000000000))
-- First few values of seed is not guaranteed to be random on some platforms
random()
random()
seeded=true
end
functionp.main(frame)
localm=tonumber(frame.args[1])
localn=tonumber(frame.args[2])
returntostring(p.random(nandmormand1or0,normor1))
end
returnp
Retrieved from "https://minecraft.wiki/w/Module:Random?oldid=2929084"

Navigation menu