Created
February 19, 2012 23:36
-
-
Save brandonhilkert/1866505 to your computer and use it in GitHub Desktop.
Random emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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