A companion build to my post on why LCGs aren’t really random.
Given five or more consecutive outputs of a linear congruential generator, the cracker reconstructs the modulus via a gcd of differenced terms, recovers the multiplier with a modular inverse, solves for the addend, and predicts the next value — all in polynomial time.
int[] outputs = {3, 2, 8, 4, 1, 5};
lcgCracker c = new lcgCracker(outputs);
c.runCracker();
See the post for the full derivation and the math behind each step.