running number increment by a random range
Hi, is there anyone who can help me, please?
I'm trying to create a running number increment by a random range such as (+3, +4, +5, etc). Right now, I've tried to use separate code for this, one to run a random, and the other to run a counter number, and make another dynamic text to sum up both of them, but it's too complicated, and it's hard to control the speed. then I try this code.
var start = 25
var end = 130
var f = tickerF.bind(this);
var current = start;
startTickerF(25, 130);
function startTickerF(startNum, endNum) {
start = startNum;
end = endNum;
current = start;
createjs.Ticker.addEventListener('tick', f);
}
function tickerF() {
this.suhu.text = current.toFixed(1);
var numberA= [ 2, 3, 4, 5 ];
current = current + numberA[Math.floor(Math.random() * numberA.length)];
}
But it didn't work. I'm sorry if this code is seems unlogic, I'm a beginner, and still trying to learn and understand it. Thanks in advance.
