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

std::set<int> Impala::Util::Random::RandomUniqueNumbers ( int  count,
int  upperBound 
) [inline]

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

Definition at line 114 of file Random.h.

References GetInt(), GetRandMax(), and ILOG_ERROR.

Referenced by GetNSamples().

00115     {
00116         std::set<int> set;
00117         if(count > upperBound)
00118         {
00119             ILOG_ERROR("count > upperBound:"<< count <<" "<< upperBound);
00120             for(int i=0 ; i<count ; ++i)
00121                 set.insert(i);
00122             return set;
00123         }
00124         if(count >= GetRandMax())
00125         {
00126             ILOG_ERROR("count >= GetRandMax:"<< count <<" "<< GetRandMax());
00127             for(int i=0 ; i<count ; ++i)
00128                 set.insert(i);
00129             return set;
00130         }
00131         while(set.size() < count)
00132         {
00133             int draw = GetInt(upperBound);
00134             if(set.find(draw) == set.end())
00135                 set.insert(draw);
00136         }
00137         return set;
00138     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:24:20 2011 for ImpalaSrc by  doxygen 1.5.1