random#

Namespaces#

Functions#

GENERATOR#

inline std::mt19937 ioh::common::random::GENERATOR(RD())#

Global random generator.

doubles#

inline std::vector<double> ioh::common::random::doubles(const unsigned int n, const double min = 0.0, const double max = 1.0)#

This function returns a vector random uniform doubles within the range [min, max].

Parameters:
  • n – The size of the vector

  • min – the minimal boundary

  • max – the maximum boundary

Returns:

vector of uniform random doubles

integer#

inline int ioh::common::random::integer(const int min = std::numeric_limits<int>::min(), const int max = std::numeric_limits<int>::max())#

This function returns a random uniform integer within the range [min, max].

Parameters:
  • min – the minimal boundary

  • max – the maximum boundary

Returns:

a random uniform integer

integers#

inline std::vector<int> ioh::common::random::integers(const unsigned int n, const int min = std::numeric_limits<int>::min(), const int max = std::numeric_limits<int>::max())#

This function returns a vector of random uniform integer within the range [min, max] of size n.

Parameters:
  • n – The size of the vector

  • min – The minimal boundary

  • max – The maximum boundary

Returns:

A vector of uniform random integers

lcg_rand#

inline long ioh::common::random::lcg_rand(long seed)#

Linear congruential generator using a given seed.

Used to generate uniform random numbers.

Parameters:

seed – Random seed

Returns:

A new seed

real#

inline double ioh::common::random::real(const double min = 0.0, const double max = 1.0)#

This function returns a random uniform double within the range [min, max].

Parameters:
  • min – the minimal boundary

  • max – the maximum boundary

Returns:

a random double

seed#

inline void ioh::common::random::seed(const unsigned int seed)#

Seed the random number generator device.

This is a std::mt19937 rng

Variables#

RD#

std::random_device ioh::common::random::RD#

Global random device.