diff options
Diffstat (limited to 'src/dict.c')
-rw-r--r-- | src/dict.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/dict.c b/src/dict.c index a26ef18d3..39af94707 100644 --- a/src/dict.c +++ b/src/dict.c @@ -621,9 +621,7 @@ dictEntry *dictGetRandomKey(dict *d) do { /* We are sure there are no elements in indexes from 0 * to rehashidx-1 */ - h = d->rehashidx + (random() % (d->ht[0].size + - d->ht[1].size - - d->rehashidx)); + h = d->rehashidx + (random() % (dictSlots(d) - d->rehashidx)); he = (h >= d->ht[0].size) ? d->ht[1].table[h - d->ht[0].size] : d->ht[0].table[h]; } while(he == NULL); |