Skip to content

Instantly share code, notes, and snippets.

@brandonhilkert
Created February 19, 2012 23:36
Show Gist options
  • Save brandonhilkert/1866505 to your computer and use it in GitHub Desktop.
Save brandonhilkert/1866505 to your computer and use it in GitHub Desktop.
Random emails
def get_random_emails(emails = [], number_of_random_emails = 1)
random_emails = []
total_emails = emails.length
return false if number_of_random_emails > total_emails
while number_of_random_emails < random_emails.length
random_emails << emails.shuffle.pop
end
random_emails
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment