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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -