Skip to content

Instantly share code, notes, and snippets.

@1000k
Created March 4, 2015 14:45
Show Gist options
  • Save 1000k/64bbaf659bd05a7fcb87 to your computer and use it in GitHub Desktop.
Save 1000k/64bbaf659bd05a7fcb87 to your computer and use it in GitHub Desktop.
if !ARGV[0] || !ARGV[1] || ARGV[1] !~ /\d+/
puts <<-USAGE
Usage: ruby anagram.rb <word> <num>
Example: ruby anagram.rb Thelonious 5
USAGE
exit
end
str = ARGV[0]
trial = ARGV[1].to_i
trial.times do |n|
puts str.split('').shuffle.join.downcase.capitalize
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment