When called with just the key argument, return a random element from the set value stored at key.
Starting from Redis version 2.6, when called with the additional count argument, return an array of countdistinct elements if count is positive. If called with a negative count the behavior changes and the command is allowed to return the same element multiple times. In this case the number of returned elements is the absolute value of the specified count.
When called with just the key argument, the operation is similar to SPOP, however while SPOP also removes the randomly selected element from the set, SRANDMEMBER will just return a random element without altering the original set in any way.
Bulk string reply: without the additional count argument the command returns a Bulk Reply with the randomly selected element, or nil when key does not exist. Array reply: when the additional countargument is passed the command returns an array of elements, or an empty array when key does not exist.
redis> SADD myset one two three(integer) 3
redis> SRANDMEMBER myset"one"
redis> SRANDMEMBER myset 21) "two" 2) "one"
redis> SRANDMEMBER myset -51) "two" 2) "three" 3) "two" 4) "two" 5) "one" redis>