I think you can do this if you use ZRANGEBYSCORE with LIMIT to get the
first element with the min score, then ZREVRANGEBYSCORE to get the
last element with the max score, get the position of both with ZRANK,
then calculate a random number between this two positions, and finally
get it with ZRANGE.
Did not tried it but should work. Otherwise of course 2.6 and
scripting can solve that as well, but internally you would a trick
similar to this, just with scripting that would be faster, and would
use a single round-time-trip.
Salvatore
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/rfyEpFGMBbQJ.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." -- Aristotele