NameSilo

Help! Set Timeout not working with random number

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
NamecheapNamecheap
Watch

traderone

Established Member
Impact
2
Hello,
I can not seem to get this to work. It is a recursive function that calls itself. It is supposed to delay 10 seconds plus a random amount. The problem I'm having is that it repeatedly calls itself every 10 seconds (exactly) without adding a random number of seconds.

Code:
var i=0;
function load(){
.....
	i++;														
	if (i<=someArray.length){
		timer=setTimeout("load()", (10000 + Math.floor(Math.random()*10*1000)));							
	}
}
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
CatchedCatched

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back