title: I want to generate a random even number between min and max using this function. What do i need to change in this function?
body: <p>I have this function which gives me a random number between min and max, excluding the numbers in notthis. How do I change it to give me a number that is an even number.        </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getrandomnumber(min,max,notthis)
  {
    var num=min+Math.floor((max-min+1)*Math.random());
    var j=notthis.indexOf(num)
  
    while (j!=-1)
    {
       num=min+Math.floor((max-min+1)*Math.random());
       j=notthis.indexOf(num)
    }
    return num;
  }
  
  a=getrandomnumber(0,100,"0,10,20")
  document.write(a)</code></pre>
  </div>
  </div>
  </p>