# determining the next random number pseudorandom number generator?

I have given 3 numbers let's say basic example x_0=5, x_1=6 and x_2=2 and modulus p is 7,

x_n=(ax_n-1+c)modp where p=7, I am trying to generate linear equations to solve but I am kind of lost

I do this

6=(a5+c)mod7 therefore 7*x+7=5a+c
2=(6a+c)mod7 therefore 7*y+2=6a+c


now I can subtract them and have 3 unknown x,y and a but two equations to solve,

I do not understand how to generate two equations with two unknows

I really appreciate your help

I read this but I could not understand

Number of samples to predict the next number in a pseudorandom number generator

If you start from $$5a+c \equiv 6 \pmod 7$$ $$6a+c \equiv 2 \pmod 7$$ then you can solve these in a similar way to ordinary simultaneous equations. Here subtraction gives $$a \equiv 2-6 \equiv 3 \pmod 7$$ and so substituting into the first equivalence $$c \equiv 6-5\times 3 \equiv 5 \pmod 7$$
You can check that $$x_n\equiv 3x_{n-1}+ 5 \pmod 7$$ for your initial values. The full cycle is $$5,6,2,4,3,0,5,\ldots$$ while $$1$$ is a fixed point