I have 2 functions that generate random numbers (first function generates 5 random sets, second function only one. I called srand(time(NULL)) in the first one, and by doing so I didn't have to call it again in the second function.
Problem is, for the second function I keep getting zero (first function is fine). Here are the two functions (these are snippets of the entire code, too long to post it all, unless you guys would need it let me know).
Edit: I #included < ctime > if you're curious, so that's not the issue.
int Winning_Numbers(int generated[])
{
int amount = 5;
int winning_ticket = generated[amount];
srand(time(NULL));
for(int x = 0; x < amount; x++)
{
generated[x] = (rand() % 69) + 1;
while (generated[x] < 1 || generated[x] > 69)
{
generated[x] = (rand() % 10) + 1;
}
if (x > 0)
{
for(int check_number = 0; check_number < x; check_number++)
{
while (generated[x] == generated[check_number])
{
generated[x] = (rand() % 10) + 1;
}
}
}
}
return winning_ticket;
}
int Powerball(int powerball_generated)
{
powerball_generated = (rand() % 26) + 1;
if (powerball_generated < 1 || powerball_generated > 26)
{
powerball_generated = (rand() % 10) + 1;
}
return powerball_generated;
}