diff -r 7d7d9debb29a -r b1ef32ab39f3 lemon/random.h --- a/lemon/random.h Fri Feb 20 18:06:10 2009 +0000 +++ b/lemon/random.h Fri Feb 20 20:43:13 2009 +0000 @@ -344,56 +344,46 @@ } }; - template = 0)> + template struct ShiftMultiplier { static const Result multiplier() { Result res = ShiftMultiplier::multiplier(); res *= res; - if ((exp & 1) == 1) res *= static_cast(2.0); - return res; - } - }; - - template - struct ShiftMultiplier { - static const Result multiplier() { - Result res = ShiftMultiplier::multiplier(); - res *= res; if ((exp & 1) == 1) res *= static_cast(0.5); return res; } }; template - struct ShiftMultiplier { + struct ShiftMultiplier { static const Result multiplier() { return static_cast(1.0); } }; template - struct ShiftMultiplier { + struct ShiftMultiplier { static const Result multiplier() { return static_cast(1.0/1048576.0); } }; template - struct ShiftMultiplier { + struct ShiftMultiplier { static const Result multiplier() { - return static_cast(1.0/424967296.0); + return static_cast(1.0/4294967296.0); } }; template - struct ShiftMultiplier { + struct ShiftMultiplier { static const Result multiplier() { return static_cast(1.0/9007199254740992.0); } }; template - struct ShiftMultiplier { + struct ShiftMultiplier { static const Result multiplier() { return static_cast(1.0/18446744073709551616.0); } @@ -413,7 +403,7 @@ static const int bits = std::numeric_limits::digits; static Result convert(RandomCore& rnd) { - return Shifting:: + return Shifting:: shift(static_cast(rnd() >> (bits - rest))); } }; @@ -423,7 +413,7 @@ static const int bits = std::numeric_limits::digits; static Result convert(RandomCore& rnd) { - return Shifting:: + return Shifting:: shift(static_cast(rnd())) + RealConversion:: convert(rnd);