If you want to think about it, most random number generators incorporate the current system time as a varible to "randomize" the numbers.
When running your program, most of the time it will run in less than 1 second, so the random number generator will return the same "random" number. A simple way to get around this is by incorporating a pause between generating random numbers.