Commit 26567722 authored by Victor Yacovlev's avatar Victor Yacovlev

Old GCC (ver 4.5.1) build fix

parent 40864d8b
......@@ -542,7 +542,7 @@ public:
std::random_device rd;
unsigned int rndValue = rd(); // in range [0..2^32]
#undef max
unsigned int rd_max = std::random_device::max();
unsigned int rd_max = rd.max();
real scale = static_cast<real>(b-a+1)/static_cast<real>(rd_max);
return Kumir::Math::imin(b, a+static_cast<int>(scale*rndValue));
}
......@@ -551,7 +551,7 @@ public:
std::random_device rd;
unsigned int rndValue = rd();
#undef max
unsigned int rd_max = std::random_device::max();
unsigned int rd_max = rd.max();
real scale = static_cast<real>(x)/static_cast<real>(rd_max);
return Kumir::Math::imin(x, 1+static_cast<int>(scale*rndValue));
}
......@@ -565,7 +565,7 @@ public:
std::random_device rd;
unsigned int rndValue = rd(); // in range [0..2^32]
#undef max
unsigned int rd_max = std::random_device::max();
unsigned int rd_max = rd.max();
real scale = static_cast<real>(b-a+1)/static_cast<real>(rd_max);
return Kumir::Math::rmin(b, a+static_cast<real>(scale*rndValue));
}
......@@ -574,7 +574,7 @@ public:
std::random_device rd;
unsigned int rndValue = rd();
#undef max
unsigned int rd_max = std::random_device::max();
unsigned int rd_max = rd.max();
real scale = static_cast<real>(x)/static_cast<real>(rd_max);
return Kumir::Math::rmin(x, static_cast<real>(scale*rndValue));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment