So, you have parts of your program that uses rand() to generate a known sequence of numbers, and other parts using rand() to generate "random" numbers?
A couple of solutions.
- Pre-generate a billion (or whatever you maximally need) numbers for the known sequences. Store them in a database, file, object, whatever, and retrieve them one-by-one.
- fork. Generate the one set of sequences in a different process than the other.
- Use a different source for your random numbers (/dev/urandom for instance).
- Use a daemon that generates the random numbers for you.
- First generate all the numbers of one type; then the other.
I'd probably go for the first option.