47 #ifndef _MIRA_RANDOM_H_ 48 #define _MIRA_RANDOM_H_ 55 #define MIRA_RANDOM mira::RandomGeneratorSingleton::instance() 102 #if defined(MIRA_LINUX) 107 #elif defined(MIRA_WINDOWS) 109 srand((
unsigned int)(
Time::now().toUnixTimestamp()));
111 srand((
unsigned int)
seed);
121 #if defined(MIRA_LINUX) 123 #elif defined(MIRA_WINDOWS) 124 return 1.0*rand()/RAND_MAX;
135 return min + (T)(
random()*(max-min));
145 assert(sigma >= 0.0);
156 }
while ((r2 > 1.0) || (r2 == 0));
159 return sigma * y * sqrt(-2.0*log(r2)/r2);
Singleton class for generating random numbers.
Definition: Random.h:81
double random()
Platform independent generation of random, double precision floating point random numbers in the inte...
Definition: Random.h:119
Implementation of the CreationPolicy that is used by the Singleton template.
Definition: Singleton.h:174
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Time and Duration wrapper class.
double gaussian(double sigma=1.0)
deprecated, use normal() instead.
Definition: Random.h:163
Provided for convenience.
Definition: Singleton.h:564
T uniform(T min, T max)
Generate uniform distributed random numbers in the interval [min, max)
Definition: Random.h:133
A singleton class that can be freely configured using policies that control the creation, instantiation, lifetime and thread-safety.
void seed(uint64 seed=0)
Seed the random number generator.
Definition: Random.h:100
static Time now() static Time eternity()
Returns the current utc based time.
Definition: Time.h:481
double normal(double sigma=1.0)
Generate standard normally distributed random numbers using a source of uniformly distributed random ...
Definition: Random.h:143