redis.zadd("myset", {"one": 1, "two": 2, "three": 3})

# "one"
redis.zrandmember("myset")

# ["one", "three"]
redis.zrandmember("myset", 2)

Arguments

key
str
required
The key of the sorted set
count
int
The number of members to return
withscores
bool
Whether to return the scores along with the members

Response

The random member(s) from the sorted setIf no count is specified, a single member is returned. If count is specified, a list of members is returned.If withscores, members are returned as a tuple of (member, score).
redis.zadd("myset", {"one": 1, "two": 2, "three": 3})

# "one"
redis.zrandmember("myset")

# ["one", "three"]
redis.zrandmember("myset", 2)