Skip to main content

SRANDMEMBER

Note

Official reference: SRANDMEMBER.

Read random set members without removing them.

Syntax

SRANDMEMBER key [count]

Positive count returns distinct members; negative counts allow repeats. Omit it for one member.

Results

ReturnRowsContent
ResultSetmultipleELEMENT field, STRING type

Example

SADD demo:tags java jdbc
SRANDMEMBER demo:tags 2