Math.random() FunctionNameMath.random() Functionreturn a pseudorandom numberAvailabilityNavigator 3.0; buggy in Internet Explorer 3.0; Unix platforms only for Navigator 2.0 DescriptionMath.random() returns a psuedorandom number between 0.0 and 1.0. Note that in Navigator 2.0, this function only works for Unix platforms. In Internet Explorer 3.0, Math.random() generates pseudorandom numbers, but is not randomly seeded, so it generates the same sequence of numbers each time the browser is started. UsageSince Math.random() does not work on all platforms, you should not rely on it if you want your scripts to be really portable. If you need only a single pseudorandom number, you can often use a portion of the current time, such as (new Date()).getSeconds()). If you need need a sequence of more reliably pseudorandom numbers (for a game, perhaps), you'll have to write your own pseudorandom number generator. The following code is based on a linear congruential algorithm in the book Numerical Recipes, and produces simple, noncryptographic, pseudorandom numbers:
function random() { random.seed = (random.seed*random.a + random.c) % random.m; return random.seed / random.m; } random.m=714025; random.a=4096; random.c=150889; random.seed = (new Date()).getTime()%random.m; BugsInternet Explorer 3.0 does not randomly seed its randomnumber generator, so it generates the same sequence of random numbers each time the browser starts up. This bug will be fixed in a future release. 
