mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
added a comment on top of the zslRandomLevel() function
This commit is contained in:
parent
06312eed86
commit
7faa1f075b
@ -64,6 +64,10 @@ void zslFree(zskiplist *zsl) {
|
||||
zfree(zsl);
|
||||
}
|
||||
|
||||
/* Returns a random level for the new skiplist node we are going to create.
|
||||
* The return value of this function is between 1 and ZSKIPLIST_MAXLEVEL
|
||||
* (both inclusive), with a powerlaw-alike distribution where higher
|
||||
* levels are less likely to be returned. */
|
||||
int zslRandomLevel(void) {
|
||||
int level = 1;
|
||||
while ((random()&0xFFFF) < (ZSKIPLIST_P * 0xFFFF))
|
||||
|
Loading…
Reference in New Issue
Block a user