can any one tell me why this random # generator only returns 42 every time
#include <stdAfx.h>
#include <iostream.h>
#include <stdlib.h> //for rand
//for printf
#include <time.h>
int rand_mid(int low,int high);
int main(int argc, char* argv[])
{
cout << endl;
cout << "you must role the dice here is the result of your role: ";
cout << rand_mid(1,100);
cout << endl;
return 0;
}
int rand_mid(int low, int high)
{
return low+rand()%(high-low+1);
}
I got this code out of the FAQ section