chars = ('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a str = (1..50).map { chars[rand(chars.size)] }.join