diff options
author | smatz <smatz@openttd.org> | 2008-02-16 00:46:38 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-02-16 00:46:38 +0000 |
commit | 7d45415b3d8dff7f1a063274bf535c6b0fa32828 (patch) | |
tree | bbe975e335be297852496faf3521b4182c6a5037 | |
parent | d7924424acb756dfe34f0302a5dd39de0230dd7c (diff) | |
download | openttd-7d45415b3d8dff7f1a063274bf535c6b0fa32828.tar.xz |
(svn r12156) -Fix (r11454): Chance16I was now biased towards zero - round to nearest now
-rw-r--r-- | src/core/random_func.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/random_func.hpp b/src/core/random_func.hpp index d941f283c..8469af661 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); } /** |