#include <RandomUtil.h>
Definition at line 50 of file RandomUtil.h.
Static Public Member Functions | |
static void | seedRandom (unsigned int s) |
seed the random number generator (a la srand48(int)) | |
static unsigned | randInt () |
static unsigned | randInt (unsigned max) |
return a random integer between 0 and max | |
static unsigned | randInt (unsigned max, unsigned first...) |
return a random integer between 0 and max with weights as given, one for each outcome | |
static unsigned | vrandInt (unsigned max, unsigned first, va_list ap) |
return a random integer between 0 and max using a va_list for calling from other variable arg methods | |
static unsigned | randInt (std::vector< unsigned > weights) |
return a random integer between 0 and weights.size() , each element being a weight | |
template<typename T> | |
static const T::key_type & | random (const T &map) |
return a random element from a map, where the key is a random outcome, and the value is a weight |
static unsigned RandomUtil::randInt | ( | ) | [inline, static] |
return a random integer between 0 and UINT_MAX
Definition at line 75 of file RandomUtil.h.
References randIntImpl().
Referenced by mace::CandidateMap< Key, Data, HashFcn, EqualKey, Alloc >::compact(), mace::MaceTime::equals(), SockUtil::getSockAddr(), mace::MaceTime::lessThan(), mace::MaceTime::lessThanOrEqual(), RandomVariable::pareto(), randint(), mace::NodeCollection< mace::AddressCacheEntry, MAX_CACHE_SIZE >::random(), mace::vector< uint64_t >::random(), mace::sparse_array< T, size >::random(), mace::set< mace::MaceKey >::random(), mace::multimap< uint64_t, TimerHandler *, mace::SoftState >::random(), mace::hash_set< Key, Serial, HashFcn, EqualKey, Alloc >::random(), mace::hash_map< uint32_t, Log::MaceTraceStream *, mace::SoftState >::random(), and mace::map< std::string, std::string >::random().