localp={}functionp.main(frame)localmax=tonumber(frame.args[1])ifnotmaxthenreturnendlocaln=string.match(mw.site.stats.edits+mw.site.stats.pages+os.time(),'%d%d%d$')n=tonumber(n)whilen>maxdon=n-maxendreturnnendlocalfunctiongetBigRandom(l,u)-- Gets a random integer between l and u, and is not limited to RAND_MAX.math.randomseed(mw.site.stats.edits+mw.site.stats.pages+os.time()+math.floor(os.clock()*1000000000))localr=0localn=2^math.random(30)-- Any power of 2.locallimit=math.ceil(53/(math.log(n)/math.log(2)))fori=1,limitdor=r+math.random(0,n-1)/(n^i)endreturnmath.floor(r*(u-l+1))+lendfunctionp.number(frame)-- Gets a random number.first=tonumber(frame.args[1])second=tonumber(frame.args[2])-- This needs to use if statements as math.random won't accept explicit nil values as arguments.iffirstthenifsecondtheniffirst>secondthen-- Second number cannot be less than the first, or it causes an error.first,second=second,firstendreturngetBigRandom(first,second)elsereturngetBigRandom(1,first)endelsereturnmath.random()endendreturnp