ZRANDMEMBER

Returns a random sorted-set member without removing it.

Sorted sets · Example verified

Syntax covered here

ZRANDMEMBER key

The tested set has one member, and the plain form returns no score.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: default
> ZADD scores 1 a
1
# connection: default
> ZRANDMEMBER scores
"a"