The Algorithm

This algorithm is very simple. It takes in a Seed, an A value, a C value and a Modulus (m).
All it does is multiply the Seed by A and add C.
Then it divides that number by M and takes the remainder to be the new Seed

seed = (seed * a + c) % m;