src/rand.cpp
// Generates a random integer in the *closed* interval [lower,upper]
Generates a random integer in the *closed* interval [lower,upper]
Generates a random integer in the * closed * interval [ lower upper ]
int RandBetween(int lower, int upper) {
  double frac;
#ifdef CYGWIN
  frac = ((float)rand()/((float)RAND_MAX + 1.0));
#else
  frac = drand48();
#endif
  return lower + (int)(frac * ((double)(upper + 1 - lower)));
}
int RandBetween ( int lower , int upper ) { double frac ; #ifdef CYGWIN frac = ( ( float ) rand ( ) / ( ( float ) RAND_MAX + 1.0 ) ) ; #else frac = drand48 ( ) ; #endif return lower + ( int ) ( frac * ( ( double ) ( upper + 1 - lower ) ) ) ; }
Generates a random integer in the *closed* interval [lower,upper]
Generates a random integer in the * closed * interval [ lower upper ]
// frac must be less than 1.0