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

std::set<int> Impala::Util::RandomUniqueNumbers ( int  count,
int  upperBound 
)

get 'count' numbers in the range [0,upperBound)

Definition at line 71 of file Random.h.

References ILOG_ERROR, ILOG_VAR, and RandomInt().

Referenced by GetNSamples().

00072 {
00073     ILOG_VAR(Impala.Util.Random.RandomUniqueNumbers);
00074     std::set<int> set;
00075     if(count > upperBound)
00076     {
00077         ILOG_ERROR("count > upperBound:"<< count <<" "<< upperBound);
00078         return set;
00079     }
00080     if(count > RAND_MAX)
00081     {
00082         ILOG_ERROR("count > RAND_MAX:"<< count <<" "<< RAND_MAX);
00083         return set;
00084     }
00085     while(set.size() < count)
00086     {
00087         int draw = RandomInt(upperBound);
00088         if(set.find(draw) == set.end())
00089             set.insert(draw);
00090     }
00091     return set;
00092 }

Here is the call graph for this function:


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