# How can I determine the initial values of pseudo-random number generator if the sequence is given?

Suppose I knew that a random number sequence was generated by a linear congruential generator. That is,

$x_{n+1}=(aX_n+c) \bmod m$

If I am given the entire period (or at least a large contiguous subsequence of it), how can I reconstruct the parameters $a,c,m$ and $x_0$ that produced this sequence? I'm looking for a general method that will be able to determine the initial parameters if the pseudo-random number generator is known.

• What precisely is known? From a contiguous subseqence you cannot tell where the sequence began $x_0$, unless the items are indexed in sequence. If $m$ is known, then $a$ and $c$ are readily discovered. Apr 3 '12 at 15:28