kevy

SRANDMEMBER

Return one or more random members of a set without removing them. A negative count allows repeats.

SyntaxSRANDMEMBER key [count]
Groupset
Arity-2
Since1.0.0
Flagsreadonly
ComplexityO(count) expected when count is a small fraction of the set (random-slot probing); O(N) once count exceeds a quarter of it, where copying and shuffling beats rejection sampling
Redis compatibilityfull

← All commands