OPTK  0.1.2
Toolkit for global optimisation algorithms
Public Member Functions | Public Attributes | Private Attributes | List of all members
sspace::randint Class Reference

#include <types.hpp>

Inheritance diagram for sspace::randint:
sspace::param_t

Public Member Functions

 randint (std::string n, int lower, int upper)
 
int sample ()
 
- Public Member Functions inherited from sspace::param_t
 param_t (std::string n, pt t)
 
virtual ~param_t ()
 
virtual pt get_type ()
 
virtual std::string get_name ()
 

Public Attributes

int m_lower
 
int m_upper
 

Private Attributes

std::random_device rd
 
std::mt19937 generator
 
std::uniform_int_distribution< int > dist
 

Detailed Description

A randint parameter has value chosen at random within the upper and lower bounds.

The lower bound is inclusive, while the upper bound is exclusive.

Constructor & Destructor Documentation

◆ randint()

sspace::randint::randint ( std::string  n,
int  lower,
int  upper 
)

The constructor

Parameters
nthe name of this parameter
lowerthe lower bound
upperthe upper bound

Member Function Documentation

◆ sample()

int sspace::randint::sample ( )

Sample from the random distribution (exclusive of upper bound).

Returns
new random integer sample.

Member Data Documentation

◆ m_lower

int sspace::randint::m_lower

Bounds of the selection range. Encapsulation should be irrelevant here so we save the effort of making getters/setters and just make these members public...


The documentation for this class was generated from the following files: