diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-08-20 10:34:55 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-08-20 14:36:52 +1000 |
commit | f1317ad1993c6f9cdf4d727c6e975023d1e885ef (patch) | |
tree | 541a908875be5262e988f4a251458b696c74bd37 | |
parent | ba32b71f75c85dd6ff3558346d19154d037888ec (diff) | |
download | mongo-f1317ad1993c6f9cdf4d727c6e975023d1e885ef.tar.gz |
Merge pull request #2130 from wiredtiger/random-init
The __wt_random code to handle an uninitialized random state is broken.
(cherry picked from commit 98b4a28e598eb70cc9aea28ea662bdb0b04372c1)
-rw-r--r-- | src/support/rand.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/support/rand.c b/src/support/rand.c index 4d0f90b87dc..12646aa3f06 100644 --- a/src/support/rand.c +++ b/src/support/rand.c @@ -83,8 +83,11 @@ __wt_random(WT_RAND_STATE volatile * rnd_state) * to initialize the state, or initializes with a seed that results in a * short period. */ - if (z == 0 || w == 0) - __wt_random_init(rnd_state); + if (z == 0 || w == 0) { + __wt_random_init(&rnd); + w = M_W(rnd); + z = M_Z(rnd); + } M_Z(rnd) = z = 36969 * (z & 65535) + (z >> 16); M_W(rnd) = w = 18000 * (w & 65535) + (w >> 16); |