Merge pull request #903 from LazyWolfLin:dev_random
PiperOrigin-RevId: 420532625
This commit is contained in:
commit
42cf899927
@ -243,7 +243,7 @@ int SkipList<Key, Comparator>::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);
|
||||||
|
Loading…
Reference in New Issue
Block a user