Fixed hte ranking bugs, everything appears to be working
Added random tie breaking explicitly, rather than relying on the instability of qsort