Shuffle a small list in Redis DB
Question:
i need to shuffle a small list (100 elements) in my Redis DB with Python.
Or is it easier to do the shuffling locally and then save it to the DB?
Is it possible?
Answers:
There is no Redis list command to shuffle the order, so you’ll need to shuffle it using Python (likely you can use the random.shuffle
method) and then store that shuffled list in Redis.
i need to shuffle a small list (100 elements) in my Redis DB with Python.
Or is it easier to do the shuffling locally and then save it to the DB?
Is it possible?
There is no Redis list command to shuffle the order, so you’ll need to shuffle it using Python (likely you can use the random.shuffle
method) and then store that shuffled list in Redis.