Replaced float vars with double to avoid conversion warnings on VS 8.0
This commit is contained in:
parent
692d26a881
commit
4c76c89592
3 changed files with 6 additions and 6 deletions
|
|
@ -9,6 +9,6 @@
|
|||
namespace eo
|
||||
{
|
||||
/// The Global random number generator.
|
||||
eoRng rng(time(0));
|
||||
eoRng rng( (uint32_t) time(0) );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ public :
|
|||
flip() tosses a biased coin such that flip(x/100.0) will
|
||||
returns true x% of the time
|
||||
*/
|
||||
bool flip(float bias=0.5)
|
||||
bool flip(double bias=0.5)
|
||||
{
|
||||
return uniform() < bias;
|
||||
}
|
||||
|
|
@ -363,7 +363,7 @@ private:
|
|||
// for normal distribution
|
||||
bool cached;
|
||||
|
||||
float cacheValue;
|
||||
double cacheValue;
|
||||
|
||||
const int N;
|
||||
|
||||
|
|
@ -471,7 +471,7 @@ inline double eoRng::normal(void)
|
|||
return cacheValue;
|
||||
}
|
||||
|
||||
float rSquare, factor, var1, var2;
|
||||
double rSquare, factor, var1, var2;
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ template <class It>
|
|||
It roulette_wheel(It _begin, It _end, double total, eoRng& _gen = rng)
|
||||
{
|
||||
|
||||
float roulette = _gen.uniform(total);
|
||||
double roulette = _gen.uniform(total);
|
||||
|
||||
if (roulette == 0.0) // covers the case where total==0.0
|
||||
return _begin + _gen.random(_end - _begin); // uniform choice
|
||||
|
|
@ -161,7 +161,7 @@ It roulette_wheel(It _begin, It _end, double total, eoRng& _gen = rng)
|
|||
template <class EOT>
|
||||
const EOT& roulette_wheel(const eoPop<EOT>& _pop, double total, eoRng& _gen = rng)
|
||||
{
|
||||
float roulette = _gen.uniform(total);
|
||||
double roulette = _gen.uniform(total);
|
||||
|
||||
if (roulette == 0.0) // covers the case where total==0.0
|
||||
return _pop[_gen.random(_pop.size())]; // uniform choice
|
||||
|
|
|
|||
Reference in a new issue