Ruby on Rails Random Password Generator

Some apps are designed where a user might sign up and be emailed a password. Here is the source code to allow for simple random password generatin.

It can also be used to change a users password if they request a new one due to forgetting the previous one:

## Generates a random password _len_ chars long skipping commonly misread characters (ex. 0/o/O 
 1/i/I)
  def generate_password( len=6 )
      chars = ("a".."h").to_a + ("j".."n").to_a + ("p".."z").to_a + ("A".."H").to_a + ("J".."N").to_a 
+ ("P".."Z").to_a +  (1..9).to_a
      newpass = ""
      1.upto(len) { |i| newpass << chars[rand(chars.size-1)]  }
      return newpass
  end

Got an example you'd like to share? Another way of doing this would be to use a yaml file of known words combined with randomness to make for easier remembering.