title: random number generator with x,y coordinates as seed
body: <p>I'm looking for a efficient, uniformly distributed PRNG, that generates one random integer for any whole number point in the plain with coordinates x and y as input to the function.</p>
  
  <pre><code>int rand(int x, int y)
  </code></pre>
  
  <p>It has to deliver the same random number each time you input the same coordinate.</p>
  
  <p>Do you know of algorithms, that can be used for this kind of problem and also in higher dimensions?</p>
  
  <p>I already tried to use normal PRNGs like a LFSR and merged the x,y coordinates together to use it as a seed value. Something like this.</p>
  
  <pre><code>int seed = x &lt;&lt; 16 | (y &amp; 0xFFFF)
  </code></pre>
  
  <p>The obvious problem with this method is that the seed is not iterated over multiple times but is initialized again for every x,y-point. This results in very ugly non random patterns if you visualize the results.</p>
  
  <p>I already know of the method which uses shuffled permutation tables of some size like 256 and you get a random integer out of it like this.</p>
  
  <pre><code>int r = P[x + P[y &amp; 255] &amp; 255];
  </code></pre>
  
  <p>But I don't want to use this method because of the very limited range, restricted period length and high memory consumption.</p>
  
  <p>Thanks for any helpful suggestions!</p>