Provides pseudo-random numbers with no repetitions.
More...
#include <Random.h>
Provides pseudo-random numbers with no repetitions.
Definition at line 112 of file Random.h.
DUtils::Random::UnrepeatedRandomizer::UnrepeatedRandomizer |
( |
int |
min, |
|
|
int |
max |
|
) |
| |
Creates a randomizer that returns numbers in the range [min, max]
- Parameters
-
Definition at line 55 of file Random.cpp.
DUtils::Random::UnrepeatedRandomizer::~UnrepeatedRandomizer |
( |
| ) |
|
|
inline |
Copies a randomizer
- Parameters
-
Definition at line 74 of file Random.cpp.
void DUtils::Random::UnrepeatedRandomizer::createValues |
( |
| ) |
|
|
protected |
Creates the vector with available values
Definition at line 97 of file Random.cpp.
bool DUtils::Random::UnrepeatedRandomizer::empty |
( |
| ) |
const |
|
inline |
Returns whether all the possible values between min and max were already given. If get() is called when empty() is true, the behaviour is the same than after creating the randomizer
- Returns
- true iff all the values were returned
Definition at line 149 of file Random.h.
int DUtils::Random::UnrepeatedRandomizer::get |
( |
| ) |
|
Returns a random number not given before. If all the possible values were already given, the process starts again
- Returns
- unrepeated random number
Definition at line 81 of file Random.cpp.
unsigned int DUtils::Random::UnrepeatedRandomizer::left |
( |
| ) |
const |
|
inline |
Returns the number of values still to be returned
- Returns
- amount of values to return
Definition at line 155 of file Random.h.
Copies a randomizer
- Parameters
-
Definition at line 116 of file Random.cpp.
void DUtils::Random::UnrepeatedRandomizer::reset |
( |
| ) |
|
Resets the randomizer as it were just created
Definition at line 107 of file Random.cpp.
int DUtils::Random::UnrepeatedRandomizer::m_max |
|
protected |
Max of range of values.
Definition at line 174 of file Random.h.
int DUtils::Random::UnrepeatedRandomizer::m_min |
|
protected |
Min of range of values.
Definition at line 172 of file Random.h.
std::vector<int> DUtils::Random::UnrepeatedRandomizer::m_values |
|
protected |
Available values.
Definition at line 177 of file Random.h.
The documentation for this class was generated from the following files: