]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: haterm: fix the random suffix multiplication
authorWilly Tarreau <w@1wt.eu>
Mon, 25 May 2026 18:43:38 +0000 (20:43 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 May 2026 18:49:22 +0000 (20:49 +0200)
commite8c9aabd62372fc2caa74b8009b22bbf784777ef
treea82992e90f43c28bd704e1b96f5e4e9f794b98b0
parent32fc35ef0929b18a3a322f2886bba856b73cc4ee
BUG/MINOR: haterm: fix the random suffix multiplication

Passing a size or anything with suffix "r" is supposed to apply a
random factor form 0 to 1. However due to the replacement of random()
with ha_random64(), all 64 bits are random before the divide, so the
end result is a random 32-bit value. In addition, ha_random64() is
slow since shared between threads.

Let's use statistical_prng() which is designed for this purpose and
is much cheaper. No backport is needed, this is only in 3.4.
src/haterm.c