Skip to content

Instantly share code, notes, and snippets.

@gtd
Created August 1, 2014 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gtd/8c24a6eaaef91ad4d66e to your computer and use it in GitHub Desktop.
Save gtd/8c24a6eaaef91ad4d66e to your computer and use it in GitHub Desktop.
module RandomCode
extend self
def generate(size = 8)
charset = %w{ 2 3 4 6 7 9 A C D E F G H J K M N P Q R T U V W X Y Z }
(0...size).map{ charset[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