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