Is there any way to increase a number by 1 after random seconds. For example, the base value is 10. So it will change by 1 after a random seconds(ie. 1/2/3/4/5 seconds randomly).
i have tried like this:
var startVal = 10;
setInterval(function(){
var theVal = startVal + 1;
startVal = theVal;
}, Math.round(Math.random() * (6000 - 2000)) + 2000);
Number is increasing but the time is not random. Please help.
Aucun commentaire:
Enregistrer un commentaire