utils.cc File Reference
#include "utils.hh"

Functions

int kbhit (void)
 Checks for key press. More...
 
std::mt19937 mt_rng (rng())
 
int getRandomInt (int min, int max)
 Get a random integer in a given interval. More...
 
double getRandomDouble (double min, double max)
 Get a random double in a given interval. More...
 

Variables

std::random_device rng
 
std::uniform_int_distribution< int > uniform_dist
 

Function Documentation

double getRandomDouble ( double  min,
double  max 
)

Get a random double in a given interval.

Value is sampled from uniform distribution

Parameters
minInterval lower bound
maxInterval upper bound
Returns
Random double
int getRandomInt ( int  min,
int  max 
)

Get a random integer in a given interval.

Value is sampled from uniform distribution

Parameters
minInterval lower bound
maxInterval upper bound
Returns
Random integer
int kbhit ( )

Checks for key press.

As seen in this gist

Returns
True on key press, False otherwise
std::mt19937 mt_rng ( rng()  )

Variable Documentation

std::random_device rng
std::uniform_int_distribution<int> uniform_dist