# File lib/password.rb, line 386 def Password.urandom(length=8) return nil unless File.chardev? '/dev/urandom' rand_data = nil File.open( "/dev/urandom" ) { |f| rand_data = f.read( length ) } # Base64 encode it Password.new( [ rand_data ].pack( 'm' )[ 0 .. length - 1 ] ) end