Quote:
Originally Posted by devnull69
Be careful
Code:
Math.floor(Math.random()*36);
will never have the value "36". Math.random() will result in values between 0 and 1, including 0 but excluding(!) 1. So you will have to use
Code:
Math.floor(Math.random()*37);
|
Ummm...but roulette *ALSO* has a "00" spot (at least on American roulette wheels). So thare are actually 38 spots.
But of course "00" and "0" are the same number, when viewed as a number. So I'd simply make the random number be -1 to 36. And then -1 means "00".
Code:
var ball = Math.floor( Math.random() * 38 ) - 1;