Determinate State of Linear Congruential Generator from Results

57 Views Asked by At

I am curious on how someone would go about determining the state of a Linear Congruential Generator given its output.

X(n-1) = (aX(n) + c) mod p

Since the values returned are deterministic and the formula is well known, it should be possible to obtain state's value. What exactly is the best way to do this?

Assume this is used to generate non-integer values between 0 and 1, but its only visible output is true or false with an expected 50/50 spread (due to the nature of the LCG). Assume the implementation is also known, so the values of a, c and p are known, but not X.

Would it be possible, with a finite amount of output, to determine the value of X?

With:

a = 1,664,525
c = 1,013,904,223
p = 2^32 (4,294,967,296)