: I got the interval to work, but every time I run a given program it
: uses the same random number; is there a way to make it a different
: number every time I run it?
:
You have to first seed the random generator, usually done with the current time.
...
#include <ctime>
#include <cstdlib>
using namespace std; // include the entire namespace
...
time_t curTime;
time(&curTime);
srand(curTime);
...
That'll get you the system time and let you seed rand() via srand() before actually calling rand() itself.
We'll be an army of theives
Of self-freed slaves
Of mild-mannered maids
We'll fight with whispers and blades
So get ready, a new day is dawning
- The New Wild West -- Jewel