Returning a random even number
<p>I have the following methods. The method rnd, returns a single random integer between two bounds:</p>

<pre><code>  /* Create next batch of 55 random numbers */
  void advance_random (){
int j1;
double new_random;
for(j1=0; j1&lt;24; j1++){
  new_random = oldrand[j1]-oldrand[j1+31];
  if(new_random&lt;0.0){
    new_random = new_random+1.0;
  }
  oldrand[j1] = new_random;
}
for(j1=24; j1&lt;55; j1++){
  new_random = oldrand[j1]-oldrand[j1-24];
  if(new_random&lt;0.0){
    new_random = new_random+1.0;
  }
  oldrand[j1] = new_random;
}
 } //advance_ramdom

  /* Fetch a single random number between 0.0 and 1.0 */
  double randomperc(){
jrand++;
if(jrand&gt;=55){
  jrand = 1;
  advance_random();
}
return((double)oldrand[jrand]);
  } //randomPerc

  /* Fetch a single random integer between low and high including the bounds */
  synchronized int rnd (int low, int high){
int res;
if (low &gt;= high){
  res = low;
} else {
  res = low + (int)(randomperc()*(high-low+1));
  if (res &gt; high){
    res = high;
  }
}
return (res);
  } // rnd
</code></pre>

<p>How do I modify this so that the number returned mod2 =0?</p>

<p>Thanks </p>
