Skip to content

Instantly share code, notes, and snippets.

@maryleloisa
Created November 9, 2015 08:37
Show Gist options
  • Save maryleloisa/b942740d211d5239323a to your computer and use it in GitHub Desktop.
Save maryleloisa/b942740d211d5239323a to your computer and use it in GitHub Desktop.
random interval ticker
var count = 0;
var final = 100;
function tick() {
count += Math.round(Math.random() * 5);
if (count >= final) {
count = final;
} else {
setTimeout(tick, Math.round(40 + Math.random() * 120));
}
$('span').text(count);
}
tick();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment