mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-02 04:13:26 +00:00
(svn r12156) -Fix (r11454): Chance16I was now biased towards zero - round to nearest now
This commit is contained in:
parent
044ca2bbf6
commit
b4f58ebae4
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user