Learn R Programming

rredis (version 1.7.0)

redisSRandMember: Choose a random element from a set

Description

Select and return an element of a set at random.

Usage

redisSRandMember(set, ...)

Arguments

set
The set key name (character).
...
Optional additional arguments. Specify raw=TRUE to skip de-serialization of the data.

Value

An element from the set selected randomly. An error is thrown if the set does not exist.

References

http://redis.io/commands

See Also

redisSAdd

Examples

Run this code
## Not run: 
# redisConnect()
# redisSAdd('set',1)
# redisSAdd('set',2)
# redisSAdd('set',3)
# redisSRandMember('set')
# ## End(Not run)

Run the code above in your browser using DataLab