I want to select a random number within a range, but say number that gets generated is 'x', next time I want the number to be at least x±20. How can I achieve this?
math.random()
takes only two parameters, So if in turn 1, the number that was selected is 40, in second it should be 50 or more/30 or less, and similarly next time it should be 60 or more/20 or less.
Don't know LUA, so we'll go for pseudocode
t = Math.random(0,60);
if (t > last_value - 20)
t += 40
last_value = t
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments