如何在 Ruby 中生成随机字符串

value = ""; 8.times{value  << (65 + rand(25)).chr}
value = ""; 8.times{value << ((rand(2)==1?65:97) + rand(25)).chr}

答案