Generate Random Password using Ruby

Generate Random Password using Ruby
This code defines a function that allows you to generate an easily readable password of the specified length, containing only valid characters.

Contextual Ads

More Ruby Resources


  1. def GeneratePass( PassLength )
  2.     CharList = (“a”..“z”).to_a + (“A”..“Z”).to_a + (“0”..“9”).to_a
  3.     GeneratePass = “”
  4.  1.upto(PassLength) { |i| GeneratePass << CharList[rand(CharList.size1)] }
  5.  return GeneratePass
  6. end

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top