Posted on 1998-09-19
I'm writting a simple game in which the user has to touch an item that ramdomly moves to a different place on the screen each time it is touched. Right now the game is incredibly too easy because the object always comes back into the game in a spot very close to the place it was already at. Here is the code I used:
srand((unsigned int) seconds);
xposition = rand() % (HIGH - LOW + 1) + LOW;
yposition = rand() % (HIGH - LOW + 1) + LOW;
Does anyone know a better way to get a random number that isn't always close to the number it was before?