title: How to use result from a hash function to get an array index?
body: <p>I am in the process of learning about bloom filters and I am looking through various hash functions in JavaScript. </p>
  
  <p>For example I found this one in another Stack Overflow answer:</p>
  
  <p>Found here <a href="https://stackoverflow.com/a/7616484/5217568">https://stackoverflow.com/a/7616484/5217568</a>)</p>
  
  <pre><code>String.prototype.hashCode = function() {
    var hash = 0, i, chr, len;
    if (this.length == 0) return hash;
    for (i = 0, len = this.length; i &lt; len; i++) {
      chr   = this.charCodeAt(i);
      hash  = ((hash &lt;&lt; 5) - hash) + chr;
      hash |= 0; // Convert to 32bit integer
    }
    return hash;
  };
  </code></pre>
  
  <p>If I run:</p>
  
  <pre><code>String.prototype.call(null, "hello") 
  </code></pre>
  
  <p>I get the numerical value of : 99162322
  (two other hash functions got me: 1335831723, and 120092131).</p>
  
  <p>Now If I create a hypothetical bloom filter with 3 hash functions, and 18 indices (k=3, m=18), How are these large values indexed in an array with indices from 0-17?</p>