#!/usr/bin/env ruby lower = "abcdefghijklmnopqrstuvwxyz" upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" nums = "0123456789" len = 10 times = 5 time = 0 until time == times out = "" until out.length == len which = rand(3) if which == 0 char = lower.slice(rand(lower.length)) end if which == 1 char = upper.slice(rand(upper.length)) end if which == 2 char = nums.slice(rand(nums.length)) end out << char end puts out time = time + 1 end