From b4f58ebae4db322a61d57788af654a7fe60e4672 Mon Sep 17 00:00:00 2001 From: smatz Date: Sat, 16 Feb 2008 00:46:38 +0000 Subject: [PATCH] (svn r12156) -Fix (r11454): Chance16I was now biased towards zero - round to nearest now --- src/core/random_func.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/random_func.hpp b/src/core/random_func.hpp index d941f283c0..8469af661a 100644 --- a/src/core/random_func.hpp +++ b/src/core/random_func.hpp @@ -88,7 +88,7 @@ static inline uint32 InteractiveRandomRange(uint16 max) { return _interactive_ra 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); } /**