summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLazyWolfLin <LazyWolfLin@gmail.com>2021-02-18 11:04:10 +0800
committerLazyWolfLin <LazyWolfLin@gmail.com>2021-05-11 22:56:37 +0800
commit3806fbc23c6b4a84b2abe26bb650e1b3d059438f (patch)
tree13e0b150aa018e9b6b2e86a111715c5b20831a06
parentf57513a1d6c99636fc5b710150d0b93713af4e43 (diff)
downloadleveldb-3806fbc23c6b4a84b2abe26bb650e1b3d059438f.tar.gz
Small fix.
Use function instead of original expression.
-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);