int number_generator(bool new_id)
{
if (new_id)
{
srand(time(NULL));
int x = 99999 + (rand() % 999999);
return x;
}
else
{
throw std::runtime_error("Oops! something went wrong");
}
}
This function generates a random 6 digit number given a true argument. I have compiled it many times, and the number it generates always start with a '1'. What am I doing wrong?