utils.hh File Reference

Useful 3rd party functions. More...

#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
#include <ctype.h>
#include <stdlib.h>
#include <random>

Go to the source code of this file.

Functions

int kbhit ()
 Checks for key press. More...
 
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...
 

Detailed Description

Useful 3rd party functions.

Author
Vinay Sajip : vsajip

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