1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-20 04:59:11 +00:00

(svn r12156) -Fix (r11454): Chance16I was now biased towards zero - round to nearest now

This commit is contained in:
smatz
2008-02-16 00:46:38 +00:00
parent 044ca2bbf6
commit b4f58ebae4

View File

@@ -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);
}
/**