I want to restart a random number sequence from
anywhere in the sequence

ex:
random sequence
3 6 7 5 3 5 6 2 9 1 2 7 0 9 3 6 0 6 2 6 ...

and I want to restart the sequence say at the first 5

5 3 5 6 2 9 1 2 7 0 9 3 6 0 6 2 6 ...

I read the man page on random and it has the
functions initstate and setstate that I'm unfamiliar
on how to use them. the example given on how to
use them leaves me unsure if they can be used in
this manner. Is there a good way to implement
what I want done with out comming up with
my own (poor) random numer generator.

one method I already thought of is to count the
random numbers that I give out and to use that
many random number over again. But what
happens when the number I am using to count
the random numbers taken wraps.
ex: a one byte number
0 1 2 ... 253 254 255 0 1 2 3 ...

I could reinvent my number so it is impossable for
it to wrap by using a struct with a number and a
pointer. Thus limiting it by memmory with malloc.
but the bigger problem then comes to the time
it takes to get to the part in the sequence.

please help me restart my sequence of random
numbers.