posted 18 years ago
i'm not sure i quite follow your question. do you mean
1) the program will be run many times. each time the program is run, you need a new number different than all the other numbers generated in all the other runs of the program
2) Within a single run of the program, you will need to generate several numbers, each different from the others. When the program dies, all values are forgotten. When the program is run again, the values generated before can be used again.
3) No matter how many times within a single run of hte program a number is generated, and no matter how many times the program is run, you NEVER want to see the same number pop up a second time. if the program stops and is restarted, the values can be re-used.
4) each run of the program will require 1 random number to be generated. If the program stops and is restarted, the same number can be used again
5) some other thing i didn't think of...
if 4 is correct, then i think Math.random() will work just fine. Otherwise, you're gonna need to do a little more, depending on which situation your talking about.
[ June 15, 2005: Message edited by: fred rosenberger ]
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors