• sundb's avatar
    Use dictGetFairRandomKey() for HRANDFIELD,SRANDMEMBER,ZRANDMEMBER (#9538) · 9967a53f
    sundb authored
    In the `HRANDFIELD`, `SRANDMEMBER` and `ZRANDMEMBER` commands,
    There are some strategies that could in some rare cases return an unfair random.
    these cases are where s small dict happens be be hashed unevenly.
    
    Specifically when `count*ZRANDMEMBER_SUB_STRATEGY_MUL > size`,
    using `dictGetRandomKey` to randomize from a dict will result in an unfair random result.
    9967a53f
t_zset.c 143 KB