How to Create a Random Number in Javascript
Saturday, February 23rd, 2008I’ve been working with PHP for some time now, and I’ve become spoiled with the rand() function for generating random numbers. It’s so simple - pass a min, pass a max, and get the number you want.
While I was working on various game-related scripts this weekend, I was left wondering how to create a random number in Javascript. It’s not quite as simple as the rand() function - we’ll have to go back to the old C-style random number generation.
(more…)