# HG changeset patch # User smatz # Date 2008-02-16 00:46:38 # Node ID 68e9cd8ed4a93035ff3b41ee94d496c7c4643206 # Parent fc02315800db2b0e01de2e11ccd2f5f5e0759fd7 (svn r12156) -Fix (r11454): Chance16I was now biased towards zero - round to nearest now diff --git a/src/core/random_func.hpp b/src/core/random_func.hpp --- a/src/core/random_func.hpp +++ b/src/core/random_func.hpp @@ -88,7 +88,7 @@ static inline uint32 InteractiveRandomRa static inline bool Chance16I(const uint a, const uint b, const uint32 r) { assert(b != 0); - return (uint16)r < (uint16)((a << 16) / b); + return (uint16)r < (uint16)(((a << 16) + b / 2) / b); } /**