
[Ruby] Random Str Gen
By: a guest on
Feb 15th, 2013 | syntax:
Ruby | size: 0.36 KB | hits: 11 | expires: Never
#Random Str Generator...
#Simple and effective by Mr. P-teo
#Learning Beginner Ruby
random_range = ('a'..'z').to_a
print "String Length: "
str_len = gets.to_i
random_string = 'String: '
char = 0;
while(char <= str_len)
rand_number = Random.rand(24)
random_string = random_string + random_range[rand_number].to_s
char += 1
end
puts random_string