summaryrefslogtreecommitdiff
path: root/sys/kern/subr_stats.c
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2019-12-26 19:41:09 +0000
committerConrad Meyer <cem@FreeBSD.org>2019-12-26 19:41:09 +0000
commitf3bae413e9d0ee6dd48cab41fc353039d49bbde7 (patch)
treefb1b04049a78c707e9231e34cffd8a608dee56b9 /sys/kern/subr_stats.c
parent3ee1d5bb9dc2db929b19ca59421d197153dbdc08 (diff)
Notes
Diffstat (limited to 'sys/kern/subr_stats.c')
-rw-r--r--sys/kern/subr_stats.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/subr_stats.c b/sys/kern/subr_stats.c
index bbdc1039237e..a212f739deca 100644
--- a/sys/kern/subr_stats.c
+++ b/sys/kern/subr_stats.c
@@ -2963,7 +2963,14 @@ stats_v1_vsd_tdgst_compress(enum vsd_dtype vs_dtype,
* re-inserting the mu/cnt of each as a value and corresponding weight.
*/
-#define bitsperrand 31 /* Per random(3). */
+ /*
+ * XXXCEM: random(9) is currently rand(3), not random(3). rand(3)
+ * RAND_MAX happens to be approximately 31 bits (range [0,
+ * 0x7ffffffd]), so the math kinda works out. When/if this portion of
+ * the code is compiled in userspace, it gets the random(3) behavior,
+ * which has expected range [0, 0x7fffffff].
+ */
+#define bitsperrand 31
ebits = 0;
nebits = 0;
bitsperidx = fls(maxctds);
@@ -2971,7 +2978,6 @@ stats_v1_vsd_tdgst_compress(enum vsd_dtype vs_dtype,
("%s: bitsperidx=%d, ebits=%d",
__func__, bitsperidx, (int)(sizeof(ebits) << 3)));
idxmask = (UINT64_C(1) << bitsperidx) - 1;
- srandom(stats_sbinuptime());
/* Initialise the free list with randomised centroid indices. */
for (; remctds > 0; remctds--) {