title: Fitting any Vector3 (x,y,z) into a linear array index
body: <p>The purpose of the function below is that an array of random numbers is generated using a seed - rnd[], and the lookup below is a fast way to find a random number associated with a given coordinate. Seems like this function converts any coordinates (x,y,z) in 3D space into an index of a fixed length array of 8192. I'm not sure if the function is accurate or not, I assume it is, but I wanted to use a much larger array than below. I feel like it isn't random enough with only 8192 of random numbers to use.</p>
  
  <p>How would I change the code to work with an array that is 262144 instead of 8192 in length?</p>
  
  <pre><code>public static float GetValue(Vector3 position) {
      long hash = 17 * 23 + (long)position.x;
      hash = hash * 23 + (long)position.y;
      hash = hash * 23 + (long)position.z;
      hash += (hash &gt;&gt; 26) + (hash &gt;&gt; 13);
      rndIndex = (uint)(hash &amp; 8191);
      return (float)rnd[rndIndex];
  }
  </code></pre>