title: A random noise function in Python
body: <p>I'm writing a game in Python in which the environment is generated randomly. Currently, the game's "save" function works by writing out all parts of the environment which the player has explored. The result is that save files are larger than they need to be—why write random data to disk when you can just generate it again?</p>
  
  <p>What I could use is a random noise function: a function <code>noise</code> such that <code>noise(x)</code> returns a random number, and always the <em>same</em> number whenever it's called with the same value of <code>x</code>. Now, for each point <code>(x,y)</code> in the game's environment, instead of generating a random number using <code>random()</code> and storing the result in <code>env[(x,y)]</code>, I can generate a random number using <code>noise((x,y))</code>, throw it away, and generate the same number later.</p>