random number in range js
A popular question on CodingForums.com. The results may be unpredictable, but the technique to getting them certainly is not. To generate a random number in JavaScript, simply use the following code: where 11 dictates that the random number will fall between 0-10. To increase the range to, say, 100, simply change 11 to 101 instead. Some of you may be curious as to why Math.floor(), instead of Math.round(), is used in the above code.