changeset 8575:edfe98e03811 draft

(svn r12156) -Fix (r11454): Chance16I was now biased towards zero - round to nearest now
author smatz <smatz@openttd.org>
date Sat, 16 Feb 2008 00:46:38 +0000
parents a34203ecde25
children b16535117c57
files src/core/random_func.hpp
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/random_func.hpp
+++ b/src/core/random_func.hpp
@@ -88,7 +88,7 @@
 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);
 }
 
 /**