Skip to content

Instantly share code, notes, and snippets.

@cvonkleist
Created February 18, 2011 15:50
Show Gist options
  • Save cvonkleist/833850 to your computer and use it in GitHub Desktop.
Save cvonkleist/833850 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
ALPHABET = ['a'..'z', 'A'..'Z', '0'..'9'].collect { |range| range.to_a }.flatten
class Array; def random; self[rand(self.length)]; end; end
length = (ARGV.shift || 10).to_i
puts Array.new(length) { ALPHABET.random }.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment