title: Generate random number in increments of X in Javascript not working
body: <p>I'm trying to generate random numbers in increments of X using a generic function in Javascript which returns a random number, my function is:</p>
  
  <pre class="lang-js prettyprint-override"><code>function getRndInteger(min, max) {
    return Math.floor(Math.random() * (max - min + 1) ) * 30 + min;
  }
  </code></pre>
  
  <p>When used, e.g: <code>getRndInteger(50, 500)</code> a random number will be generated, e.g: <code>253</code>, however, I'm trying to modify my function to generate a random number between Z and X, but in increments of A, so for instance, <code>250, 300, 350, 400 ...</code> etc. I've tried:</p>
  
  <pre class="lang-js prettyprint-override"><code>function getRndInteger(min, max) {
    return Math.floor(Math.random() * (max - min + 1) ) * 50 + min;
  }
  
  // and...
  
  function getRndInteger(min, max) {
    return Math.floor(Math.random() * (max - min + 1) * 50 ) + min;
  }
  </code></pre>
  
  <p>both of these return numbers beyond my maximum number.</p>