浏览代码

Merge pull request #903 from LazyWolfLin:dev_random

PiperOrigin-RevId: 420532625
main
Victor Costan 2 年前
父节点
当前提交
42cf899927
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. +1
    -1
      db/skiplist.h

+ 1
- 1
db/skiplist.h 查看文件

@ -243,7 +243,7 @@ int SkipList::RandomHeight() {
// Increase height with probability 1 in kBranching // Increase height with probability 1 in kBranching
static const unsigned int kBranching = 4; static const unsigned int kBranching = 4;
int height = 1; int height = 1;
while (height < kMaxHeight && ((rnd_.Next() % kBranching) == 0)) {
while (height < kMaxHeight && rnd_.OneIn(kBranching)) {
height++; height++;
} }
assert(height > 0); assert(height > 0);

正在加载...
取消
保存