16bool DUtils::Random::m_already_seeded =
false;
26 if (!m_already_seeded)
29 m_already_seeded =
true;
40 if (!m_already_seeded)
43 m_already_seeded =
true;
48 int d = max - min + 1;
49 return int(((
double)rand() / ((
double)RAND_MAX + 1.0)) * d) + min;
83 if (empty()) createValues();
88 int ret = m_values[k];
89 m_values[k] = m_values.back();
99 int n = m_max - m_min + 1;
102 for (
int i = 0; i < n; ++i) m_values[i] = m_min + i;
109 if ((
int)m_values.size() != m_max - m_min + 1) createValues();
115DUtils::Random::UnrepeatedRandomizer::operator=
120 this->m_min = rnd.
m_min;
121 this->m_max = rnd.m_max;
122 this->m_values = rnd.m_values;
Provides pseudo-random numbers with no repetitions.
int m_min
Min of range of values.
UnrepeatedRandomizer(int min, int max)
static void SeedRandOnce()
static int RandomInt(int min, int max)
double getFloatTime() const