//put this with all your other include declarations
#include <ctime>
...
//stick this near the beginning of your code. The first line of main() should do it.
srand ( time(NULL) );
Then any time afterwards, you can call rand() to get a random number between 0 and RAND_MAX, which is always at least 32767. If you want a smaller range, you can use the modulus operator:
1 2 3
int upperLimit = 10;
int myNumber = rand() % upperLimit;
//myNumber is now somewhere between 0 and 9
Thanks - I was actually hoping for something a little more random than what was provided by rand(), but my own fault for not specifying. Thank you for posting all the same!