Randomizing random numbers (SOLVED)

Started by AJA, Thu 25/05/2006 23:28:39

Previous topic - Next topic

AJA

I have this problem that the random numbers I store into global variables aren't regenerated when the game restarts. Any ideas?

Btw, I assign the values in the first room of the game after the restart point.

Kweepa

What do you mean, they aren't regenerated?
You mean they are the same value?
It's probably because the random number generator is reset when the game is restarted, so it produces the same values again.
Try using the current time to randomise the sequence.
Code: ags

DateTime *dt = DateTime.Now;
int i = 0;
while (i < dt.Second)
{
  int dummy = Random(1);
  i++;
}
// your code here

Still waiting for Purity of the Surf II

AJA

Hey, that worked like a charm! Thanks! :D

SMF spam blocked by CleanTalk