Created
November 21, 2014 11:32
-
-
Save selvan/332548ea8c1389100bdf to your computer and use it in GitHub Desktop.
Random Alpha Numeric String Generator
This file contains hidden or 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
module RandomAlphaNumeric | |
@deck = [(0..9), ('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten | |
def self.generate(length) | |
@deck.shuffle[0, length].join | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment