Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DUtils::Random::UnrepeatedRandomizer Class Reference

Provides pseudo-random numbers with no repetitions. More...

#include <Random.h>

Public Member Functions

bool empty () const
 
int get ()
 
unsigned int left () const
 
UnrepeatedRandomizeroperator= (const UnrepeatedRandomizer &rnd)
 
void reset ()
 
 UnrepeatedRandomizer (int min, int max)
 
 UnrepeatedRandomizer (const UnrepeatedRandomizer &rnd)
 
 ~UnrepeatedRandomizer ()
 

Protected Member Functions

void createValues ()
 

Protected Attributes

int m_max
 Max of range of values. More...
 
int m_min
 Min of range of values. More...
 
std::vector< int > m_values
 Available values. More...
 

Detailed Description

Provides pseudo-random numbers with no repetitions.

Definition at line 112 of file Random.h.

Constructor & Destructor Documentation

DUtils::Random::UnrepeatedRandomizer::UnrepeatedRandomizer ( int  min,
int  max 
)

Creates a randomizer that returns numbers in the range [min, max]

Parameters
min
max

Definition at line 55 of file Random.cpp.

DUtils::Random::UnrepeatedRandomizer::~UnrepeatedRandomizer ( )
inline

Definition at line 122 of file Random.h.

DUtils::Random::UnrepeatedRandomizer::UnrepeatedRandomizer ( const UnrepeatedRandomizer rnd)

Copies a randomizer

Parameters
rnd

Definition at line 74 of file Random.cpp.

Member Function Documentation

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.

DUtils::Random::UnrepeatedRandomizer & DUtils::Random::UnrepeatedRandomizer::operator= ( const UnrepeatedRandomizer rnd)

Copies a randomizer

Parameters
rnd

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.

Member Data Documentation

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:


orb_slam2_with_maps_odom
Author(s): teng zhang
autogenerated on Fri Sep 25 2020 03:24:47