05-23-2010, 01:50 PM
(03-23-2010, 10:16 PM)nevets04 Wrote:Code:[code]
print "How many characters do you want in your password?: "
characters = gets.chomp
puts "1) Yes"
puts "2) No"
print "Do you want numbers?: "
numbers = gets.chomp
characters = characters.to_i
numbers = numbers.to_i
if numbers == 2
while 0 < characters
characters = characters - 1
password = (?a.ord + rand(26)).chr
print password
end
end
if numbers == 1
characters = characters / 2
while 0 < characters
characters = characters - 1
password = (?a.ord + rand(26)).chr
passwordnumber = rand(10)
print password, passwordnumber
end
end
puts ""
good work friend!