Pseudo Random Generator (PRG) from Rabin function I'm trying to make a PRG using the Rabin function. The code (in Java) I wrote to implement the function is:

poublic static int rabinFunction(int m, int publicKey) {
    return (int) Math.pow(m, 2) % publicKey;
}


A trivial usage (using the numbers from the wikipedia link) would be:

int m = 20;
int pq = 7 * 11;

// output will be 15
int output = rabinFunction(20, 77);


I'm using this one way function to create a pseudo random generator. Basically, I run the Rabin function and use the least significant bit from the function output as part of my pseudorandom value. I use the return value from the previous execution as the seed for the next execution and I repeat this process until I've generated enough bits to encrypt my message. The issue I'm having is that the Rabin function returns the same values after 4 iterations:

rabinFunction(20, 77); //==&gt; 15
rabinFunction(15, 77); //==&gt; 71
rabinFunction(71, 77); //==&gt; 36
rabinFunction(36, 77); //==&gt; 64
rabinFunction(64, 77); //==&gt; 15! Back to where we started, etc


I'm assuming that using the output from a previous execution of the Rabin function as the seed for a new one isn't correct. Can someone explain why this is wrong? Thanks in advance.
The modulus 77 leads to a short period.