Skip to content

Instantly share code, notes, and snippets.

@mattweidner
Created March 30, 2016 04:53
Show Gist options
  • Save mattweidner/052465782be1342f1d6b984e877423d0 to your computer and use it in GitHub Desktop.
Save mattweidner/052465782be1342f1d6b984e877423d0 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# Source characters array
range = [*'0'..'9',*'A'..'Z',*'a'..'z']
puts "#{range}"
# Build a 20 char random string from the source array.
a = Array.new(20) { range.sample }.join
puts "#{a}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment