Error in random number generator
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@873 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -75,7 +75,7 @@ RandomNumberGenerator::RandomNumberGenerator(const size_t _resolution) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ( unsigned int i = 0 ; i < iterations_ - 1; ++i ) {
|
for ( unsigned int i = 0 ; i < iterations_ - 1; ++i ) {
|
||||||
maxNum_ *= (RAND_MAX + 1);
|
maxNum_ *= (RAND_MAX + 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ double RandomNumberGenerator::getRand() const {
|
|||||||
return randNum / maxNum_;
|
return randNum / maxNum_;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t RandomNumberGenerator::resolution() const {
|
double RandomNumberGenerator::resolution() const {
|
||||||
return maxNum_;
|
return maxNum_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
/// returns a random double between 0.0 and 1.0 with a guaranteed resolution
|
/// returns a random double between 0.0 and 1.0 with a guaranteed resolution
|
||||||
double getRand() const;
|
double getRand() const;
|
||||||
|
|
||||||
size_t resolution() const;
|
double resolution() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ private:
|
|||||||
size_t iterations_;
|
size_t iterations_;
|
||||||
|
|
||||||
/// maximum random number generated, which is used for normalization
|
/// maximum random number generated, which is used for normalization
|
||||||
size_t maxNum_;
|
double maxNum_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user