Selecting a number randomly with math.random() -
i want select random number within range, number gets generated 'x', next time want number @ least x±20. how can achieve this?
math.random() takes 2 parameters, if in turn 1, number selected 40, in second should 50 or more/30 or less, , next time should 60 or more/20 or less.
don't know lua, we'll go pseudocode
t = math.random(0,60); if (t > last_value - 20) t += 40 last_value = t
Comments
Post a Comment