Provides pseudo-random numbers with no repetitions.
More...
#include <Random.h>
|
int | m_min |
| Min of range of values.
|
|
int | m_max |
| Max of range of values.
|
|
std::vector< int > | m_values |
| Available values.
|
|
Provides pseudo-random numbers with no repetitions.
Definition at line 112 of file Random.h.
◆ UnrepeatedRandomizer() [1/2]
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.
◆ ~UnrepeatedRandomizer()
DUtils::Random::UnrepeatedRandomizer::~UnrepeatedRandomizer |
( |
| ) |
|
|
inline |
◆ UnrepeatedRandomizer() [2/2]
Copies a randomizer
- Parameters
-
Definition at line 73 of file Random.cpp.
◆ createValues()
void DUtils::Random::UnrepeatedRandomizer::createValues |
( |
| ) |
|
|
protected |
Creates the vector with available values
Definition at line 97 of file Random.cpp.
◆ empty()
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.
◆ get()
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.
◆ left()
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.
◆ operator=()
Copies a randomizer
- Parameters
-
Definition at line 115 of file Random.cpp.
◆ reset()
void DUtils::Random::UnrepeatedRandomizer::reset |
( |
| ) |
|
Resets the randomizer as it were just created
Definition at line 107 of file Random.cpp.
◆ m_max
int DUtils::Random::UnrepeatedRandomizer::m_max |
|
protected |
Max of range of values.
Definition at line 174 of file Random.h.
◆ m_min
int DUtils::Random::UnrepeatedRandomizer::m_min |
|
protected |
Min of range of values.
Definition at line 172 of file Random.h.
◆ m_values
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: