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

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
smatz 17 years ago
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) static inline bool Chance16I(const uint a, const uint b, const uint32 r)
{ {
assert(b != 0); assert(b != 0);
return (uint16)r < (uint16)((a << 16) / b); return (uint16)r < (uint16)(((a << 16) + b / 2) / b);
} }
/** /**

Loading…
Cancel
Save