Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

int Impala::Util::RandomInt ( int  upperBound  ) 

Gives a random integer in range [0,i).

Note that this differs from the implementation in RandomGenerator.h For people who wonder about the sense of these bounds: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html?

Definition at line 37 of file Random.h.

References ILOG_VAR, and ILOG_WARNING.

Referenced by DumpRandomSequence(), RandomInt(), and RandomUniqueNumbers().

00038 {
00039     ILOG_VAR(Impala.Util.Random.RandomInt);
00040     if(upperBound > RAND_MAX)
00041         ILOG_WARNING(upperBound <<" upperBound > RAND_MAX "<< RAND_MAX);
00042     return (int) (((double) std::rand() / ((double) RAND_MAX + 1.0)) *
00043                   upperBound);
00044 }


Generated on Fri Mar 19 11:39:13 2010 for ImpalaSrc by  doxygen 1.5.1