I'm currently developing a game (And no, just because that's the case doesn't mean this belongs in game development), and I've run into a problem.
Basically, I need to generate a random number.
The number needs to stay the same after it is generated once.
The code is in an infinite loop, which makes it very difficult.
I've tried getting around it by making it choose the number at the top where all the other global variables are declared, but this makes the variable choose a value before srand is even activated, so it just picks the same number each time.