title: PRNG seeded by key in java
body: <p>I need to create numbers pseudo randomly using a key. key is a string converted to byte array.
  This is what i came up with: </p>
  
  <pre><code>    int N=10;
      int key[]= {13,10,1,5};
      int tmp,j=0;
      for (int i=0; i &lt; N; i++) { 
          j = (j + key[i % key.length]) % N; 
          System.out.println(j);
      }
  </code></pre>
  
  <p>This code is taken from PRNG of RC4 and modified. Its not working as expected, values are repeating.</p>