I am a beginner programmer, and one of my apps has the rand() function as a fundamental part of it. However, whenever I run the app, it generates the same numbers in the same order. I can't figure out what is wrong with it, are there any other random methods or bug fixes that you can suggest?
You have to use the srand function to seed the random number generator before you call rand() for the first time. As long as you use a different seed each time you run the program (commonly the current system time is used), you'll get a different sequence of random numbers on each run.
If you don't call srand (or call it with the same argument on each run), the random generator will use the same seed each time, which will cause it to produce the same sequence of random numbers on each run.