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 -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -