random slee

master
ugrnm 6 years ago
parent 58a6356f5b
commit 6be59aa379

@ -65,15 +65,24 @@
"If the biggest obstacle in your life was removed, how would your life change?" "If the biggest obstacle in your life was removed, how would your life change?"
]; ];
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function sleep(ms) { function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
async function iris(){ async function iris(){
var ms = 0;
while (true) { while (true) {
ms = getRandomInt(100,3000);
Message = Messages[Math.floor(Math.random()*Messages.length)]; Message = Messages[Math.floor(Math.random()*Messages.length)];
document.getElementById('oneliner').innerHTML = Message; document.getElementById('oneliner-1').innerHTML = Message;
await sleep(2500); await sleep(ms);
} }
} }

Loading…
Cancel
Save