Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
weighted shuffle in ruby.
things.sort_by do |thing|
-((thing.created_at.to_f / * rand)
Copy link

coleww commented Jul 18, 2014

for when the client wants results sorted randomly AND by most recent >_<

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment