There is a SET c 1000 id, you need to choose 3 random and non-repeating.
The decision "in the forehead" - make SRANDMEMBER 3 times, but there is no guarantee that there will be no repetitions.
You can - control replays at the client level and cycle the SRANDMEMBER cycle until the received set is unique, but this is also somewhat clumsy.
Sort by random value (something in the spirit of SORT ... BY RAND LIMIT 3 INTO ...) Redis does not know how.
As a result, SORT ... INTO ... the resulting list will be of type LIST and you cannot make SPOP from there several times.
Suddenly someone knows an elegant way?
Now the dictGetRandomKey function is used in the following cases: when expiring, when receiving a random key from the database, when checking whether the element can be swapped and when receiving a random element of the set.
Or in the forehead. SPOP with a large load - you need to configure so that redis does not start to constantly re-save data on the screw due to constantly changing data, and IMHO is an additional risk of losing it.