Last active
August 29, 2015 14:06
-
-
Save ksaynice/823a54740d5e47bb72da to your computer and use it in GitHub Desktop.
Random generate access code
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
class AccessCodeGenerator | |
def self.generate(size = 13) | |
charset = ([*('A'..'Z'),*('0'..'9')]-%w(0 1 5 8 B I L O S U)) | |
(0...size).map{ charset.to_a[SecureRandom.random_number(charset.size)] }.join | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment