Skip to content

Instantly share code, notes, and snippets.

@ksaynice
Last active August 29, 2015 14:06
Show Gist options
  • Save ksaynice/823a54740d5e47bb72da to your computer and use it in GitHub Desktop.
Save ksaynice/823a54740d5e47bb72da to your computer and use it in GitHub Desktop.
Random generate access code
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