From: bobx@... (Bob) Date: 2002-10-31T02:18:06+09:00 Subject: Please help me modify this... This currently works: # define defaults which can be # overridden from the command prompt $minlen = 7 $maxlen = 9 # generator function def generate_password(minlen=$minlen, maxlen=$maxlen) chars = ("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a pwlen = rand(maxlen - minlen) + minlen + 1 (1..pwlen).to_a.collect {|x| chars[rand(chars.length)] }.join end puts generate_password I am trying to add a $strength variable as well. 1 would be ("a".."z").to_a 2 would be ("a".."z").to_a + ("A".."Z").to_a and 3 would be the current one. I tryed splitting it out with an IF...ELSIF like: if $strength == 1 then chars = ("a".."z").to_a elsif $strength == 2 then chars = ("a".."z").to_a + ("A".."Z").to_a elsif $strength == 3 then chars = ("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a Doesn't seem to like that...I am also gonna do a GetoptLong to take command line parameters to override the defaults but I need to get past the split out. Also how would I add symbols (i.e. ~ ! @ # $ % ^ & * ( ) + = )? Help is much appreciated... Bob