Apr 7, 2010
ideaIn the dreamnight animation we needed random positions and random colors for bubbles.
Math.random()The random() method returns a random number between 0 and 1.
Generating random number less than M
This will generate no between 0 and M
var randomnumber = Math.floor(Math.random()*(M + 1));
Generating random number between higher and lower
parseInt(rand_no = Math.floor((higher - (lower - 1)) * Math.random()) + lower);
Generating random colors
OR if you need it in hex -
Math.round(0xffffff * Math.random()).toString(16)
I hope now you are able to solve your problem you googled.
By : Motyar+ @motyar