Call this function to generate a set of five random numbers (maxRandom)...
local function generaterandom() local maxRandom = 5 for m = 1, randCount do randomArray[m]=-100 end local i = 1 while ilocal randNum = math.random (1, maxRandom) local flagNew = false for j = 1 , randCount do if randomArray[j]==randNum then flagNew = true break end end if flagNew==false then randomArray[i]=randNum i=i+1 end end for k=1, randCount do print("Values---->".. randomArray[k]) end end
Comments
Post a Comment