rand() was designed to generate repeatable
sequences of "random" numbers.
The sequences are repeatable because they are identified with a sequence number. If you don't choose a specific sequence number for your numbers, the compiler will use sequence number 1.
To choose a specific sequence number (let's say sequence #1234567) use srand()
srand(1234567); /* use sequence #1234567 */
To choose a different sequence every time you run your program, choose a different sequence number everytime
A simple way to do that is to use the number of seconds since the Epoch as the sequence number.
srand(time(0)); /* use a different sequence number (almost) every time */
Remember the prototype for srand() (and rand() is in <stdlib.h>) and the prototype for time() is in <time.h>.
Note: changing the sequence number mid-way through your program effectively reduces
the randomness of the generated random numbers, so you want to call srand() only once each time the program is executed.