The random number function is an equation that simulates being random, but, it is still a function. If you give it the same seed the first answer will be the same.
You could try changing the seed, and do this when the javascript is first loaded, so that if there is a time component to the random number generator, then it can use the delays of pages being loaded to randomize the numbers more.
But, you may want to change the seed. You the Date()
function, then get the milliseconds and use that as the seed, and that may help to scramble it up first.
My thought that there is a time component to the generator is the fact that it changes with an alert, as that will delay when the next number is generated, though I haven't tested this out.
UPDATE:
I realize the specification states that there is no parameter for Math.random, but when you look at this article, he explains that there was a seed being used:
http://codepunk.hardwar.org.uk/ajs13.htm
I came at this from C and then Java, so the fact that there was no error using an argument led me to think it used it, but now I see that that was incorrect.
If you really need a seed, your best bet is to write a random number generator, and then Knuth books are the best starting point for that.