61 #include <OpenMesh/Core/Utils/RandomNumberGenerator.hh> 73 resolution_(_resolution),
75 maxNum_(RAND_MAX + 1.0)
78 while (tmp > (
double(RAND_MAX) + 1.0) ) {
80 tmp /= (double(RAND_MAX) + 1.0);
83 for (
unsigned int i = 0 ; i <
iterations_ - 1; ++i ) {
93 randNum *= (RAND_MAX + 1.0);
100 double RandomNumberGenerator::resolution()
const {
double getRand() const
returns a random double between 0.0 and 1.0 with a guaranteed resolution
size_t iterations_
number of "blocks" of RAND_MAX that make up the desired _resolution
const size_t resolution_
desired resolution
RandomNumberGenerator(const size_t _resolution)
Constructor.
double maxNum_
maximum random number generated, which is used for normalization