2 ms·
I agree that for some data type like Sets you could use SRANDMEMBER, however to sample all the elements by random sampling you need to perform a lot more work.
by antirez 13y ago
I agree that for some data type like Sets you could use SRANDMEMBER, however to sample all the elements by random sampling you need to perform a lot more work. For example for a 10000 elements collection in average you are going to need around 10 times the requests.
- jwr 13y agoYes. I was lucky to have applications where that wasn't a problem — mostly because this kind of work was done regularly and incrementally, rather than rarely and in a big chunk.