38 #include <Base/Math/Random.hh>
39 #include <Base/Debug/TimeMeasure.hh>
44 #define HIST_BIN_COUNT 64
50 unsigned int hist[HIST_BIN_COUNT];
53 double min=-100.0, max=100.0;
56 long unsigned int count=100000;
57 long unsigned int sumuniform=0;
62 memset((
void *)hist, 0, HIST_BIN_COUNT*
sizeof(
unsigned int));
65 double *uniform=
new double[count];
69 cerr <<
"getting "<<count<<
" uniform distributed random vars took "
71 for (
register unsigned int i=0; i<count; i++){
75 hist[(
unsigned int)floor((num-min)/(max-min)*HIST_BIN_COUNT)]++;
77 for (
int i=0; i< HIST_BIN_COUNT; i++){
78 cout << i <<
": \t" << hist[i] << endl;
81 cerr <<
"got "<<sumuniform<<
" uniform distributed vars\n";
double GetUniformDistributed(const double min, const double max)
on succesive calls return uniform distributed random variable between min and max ...
double GetRealTime() const
return real time (=wall time clock) in usec JW For Win32: real-time is measured differently from user...
class for producing random numbers from different distributions
class TimeMeasure contains functions for timing real time and cpu time.