Emulate PHP’s Rand() Function in Javascript
Filed under Javascript
Javascript’s random number generator is lacking a lot of power. To create a number between say 0 and 10, you can do this:
number = Math.round(Math.random()*10);
Of course you can modify this slightly to fit your needs, but this should be the basics needed.
Leave a Reply