You have to seed your rand() function.. Put srand(time(NULL)) in your main function.