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.
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)