Skip to content

Instantly share code, notes, and snippets.

@Neurogami
Created September 10, 2016 19:26
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 Neurogami/763d1be418b7ea1c4812ac09e3e36264 to your computer and use it in GitHub Desktop.
Save Neurogami/763d1be418b7ea1c4812ac09e3e36264 to your computer and use it in GitHub Desktop.
def random_string_using_char_set len, chars
(0...len).map { chars[rand(chars.size)] }.join
end
safe_chars = (('A'..'Z').to_a + ('a'..'z').to_a + ('3'..'9').to_a ) - %w{5 S Z l o O}
some_string = random_string_using_char_set 50, safe_chars
p some_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment