RACIPELIB.c
// Generate discrete integer between minN and maxN
Generate discrete integer between minN and maxN
Generate discrete integer between minN and maxN
double randd(double minN, double maxN, int dist)
{
  double u = 0.0;
  double z = 0.0;
  int cnt  = 0;
  int i    = 0;
  do {
    if (dist == 1) {
      u = randu(minN-1, maxN+1);
    }
    else if (dist == 2){
      u = randpg((minN+maxN)/2.0, (maxN-minN)/2.0);
    }
    else if (dist == 3){
      u = randexp((minN+maxN)/2.0);
    }
    for (i = 0; i < (maxN-minN+1); i++){
      if (u >= minN-0.5+i && u < minN+0.5+i){
        z = minN + i;
        cnt = 1;
        break;
      }
    }
  } while (u == maxN+0.5 || cnt == 0);
  return z; 
}
double randd ( double minN , double maxN , int dist ) { double u = 0.0 ; double z = 0.0 ; int cnt = 0 ; int i = 0 ; do { if ( dist == 1 ) { u = randu ( minN - 1 , maxN + 1 ) ; } else if ( dist == 2 ) { u = randpg ( ( minN + maxN ) / 2.0 , ( maxN - minN ) / 2.0 ) ; } else if ( dist == 3 ) { u = randexp ( ( minN + maxN ) / 2.0 ) ; } for ( i = 0 ; i < ( maxN - minN + 1 ) ; i ++ ) { if ( u >= minN - 0.5 + i && u < minN + 0.5 + i ) { z = minN + i ; cnt = 1 ; break ; } } } while ( u == maxN + 0.5 || cnt == 0 ) ; return z ; }
Generate discrete integer between minN and maxN
Generate discrete integer between minN and maxN