summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-05-29 11:22:27 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-05-29 11:22:27 +1000
commitb3f62b4381c358ab79fd2f76315b85b920f0e701 (patch)
tree8eaf749617806252e6020112a202de1c3a2e0e6c /bench
parent0698139a520463498d4f5c7e6b8c6e30bfd91e13 (diff)
downloadmongo-b3f62b4381c358ab79fd2f76315b85b920f0e701.tar.gz
Fix the pareto calculation in wtperf: __wt_random returns values up to UINT32_MAX, not RAND_MAX.
found when testing for #1032
Diffstat (limited to 'bench')
-rw-r--r--bench/wtperf/wtperf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c
index 2b5059c2010..36e603cf4b0 100644
--- a/bench/wtperf/wtperf.c
+++ b/bench/wtperf/wtperf.c
@@ -2178,12 +2178,12 @@ wtperf_rand(CONFIG *cfg)
#define PARETO_SHAPE 1.5
S1 = (-1 / PARETO_SHAPE);
S2 = wtperf_value_range(cfg) * 0.2 * (PARETO_SHAPE - 1);
- U = 1 - (double)rval / (double)RAND_MAX;
+ U = 1 - (double)rval / (double)UINT32_MAX;
rval = (pow(U, S1) - 1) * S2;
/*
* This Pareto calculation chooses out of range values about
* about 2% of the time, from my testing. That will lead to the
- * last item in the table being "hot".
+ * first item in the table being "hot".
*/
if (rval > wtperf_value_range(cfg))
rval = wtperf_value_range(cfg);