How do I filter posts by most liked/voted?

So it’s pretty simple, there’s way to filter posts by date, random, etc.. How do I filter it to show the posts with the most likes/votes? Is there a specific php code I can add to the post query thing?

This is how my posts are pulled:

<?php $i = 0; while (have_posts()) : the_post(); $i++; ?>

I add this to make it random..

<?php query_posts(‘orderby=rand’:wink:; $i = 0; while (have_posts()) : the_post(); $i++; ?>

How would I edit that to show it with the top liked posts at the top? Throwing out the random thing.. Just showing how I know how to edit it already..

Thanks in advance.