[gameprogrammer] Random Integer Problem :(

Hi,

I'm trying to use this code to generate a random number between 1 and six
inclusive:

int random_int() {
   srand(time(NULL));
   int random_num=rand()%7;
   return random_num;
}

But it dosen't work. My program is programmed to quit immediantly if the
number is not between 1 and six inclusive, and that is what it does

Other related posts: