I have a random number function and when i call it in another function two different times how come it is always the same number.
The rand function looks like this
If i call it twice for exampleCode:int getRand(int i) { srand(time(NULL)); return (rand()%i)+1; }
It always prints different values when the program runs but it prints the same value each time for both numbers. How come?Code:num1 = getRand(9); num2 = getRand(9);