Skip to content

Instantly share code, notes, and snippets.

@charliepark
Created July 25, 2011 11:15
Show Gist options
  • Save charliepark/1103935 to your computer and use it in GitHub Desktop.
Save charliepark/1103935 to your computer and use it in GitHub Desktop.
Ruby code to create a random string, with no confusable digits (no "0 / O", "1 / I / l", "5 / S", "8 / B" crosses, etc.).
def generate_domain_key
charset = %w{ 2 3 4 6 7 9 A C D E F G H J K L M N P Q R T V W X Y Z}
(0...16).map{ charset[rand(charset.size + 1)] }.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment