summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Costan <pwnall@chromium.org>2022-01-09 03:15:22 +0000
committerVictor Costan <pwnall@chromium.org>2022-01-09 03:15:22 +0000
commit42cf89992724487f8bf08f17804de38921f973c6 (patch)
tree42997b75ae822e1b06f8ec0b7d12f97529815261
parent8796c44772e63eafe916921cf8f5fa940f53106b (diff)
parent3806fbc23c6b4a84b2abe26bb650e1b3d059438f (diff)
downloadleveldb-42cf89992724487f8bf08f17804de38921f973c6.tar.gz
Merge pull request #903 from LazyWolfLin:dev_random
PiperOrigin-RevId: 420532625
-rw-r--r--db/skiplist.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/db/skiplist.h b/db/skiplist.h
index a59b45b..f716834 100644
--- a/db/skiplist.h
+++ b/db/skiplist.h
@@ -243,7 +243,7 @@ int SkipList<Key, Comparator>::RandomHeight() {
// Increase height with probability 1 in kBranching
static const unsigned int kBranching = 4;
int height = 1;
- while (height < kMaxHeight && ((rnd_.Next() % kBranching) == 0)) {
+ while (height < kMaxHeight && rnd_.OneIn(kBranching)) {
height++;
}
assert(height > 0);