You would like to use a random password in ruby. Most solutions describe using the Digest library (Digest::SHA1).
According to the post here, you can achieve the same by using ActiveSupport’s secure_random library.
To use it in Ruby outside Rails use:
require 'active_support/secure_random' ActiveSupport::SecureRandom.hex(10) ActiveSupport::SecureRandom.base64(10)
and inside rails: