diff --git a/include/haproxy/tools.h b/include/haproxy/tools.h index 90d46a60d..3059fa847 100644 --- a/include/haproxy/tools.h +++ b/include/haproxy/tools.h @@ -1063,7 +1063,7 @@ static inline unsigned int statistical_prng() */ static inline uint statistical_prng_range(uint range) { - return mul32hi(statistical_prng(), range); + return mul32hi(statistical_prng(), range ? range - 1 : 0); } /* Update array with the character transition to . If