kevy4.0

SRANDMEMBER

Return one or more random members of a set without removing them.

SRANDMEMBER key [count]
Group
Set
Since
1.0.0
Arity
at least 2
Flags
readonly

Complexity

O(count) expected

Complexity and compatibility are read out of kevy's implementation, not copied from Redis's reference. Several genuinely differ.

Redis compatibility

Differs

NOT random — it returns the same first-bucket member every time for a given set; a negative count is rejected instead of returning |count| members with repetitions

See also

SADDSCARDSDIFFSDIFFSTORESINTERSINTERSTORESISMEMBERSMEMBERSSPOPSREMSSCANSUNIONSUNIONSTORE

← All commands