irb> num = ''
=> ""
irb> 5.times{num += (%[1 2 3 4 5][rand(5)]).to_s}
=> 5
irb> num
=> "3249514950"

どうして5桁じゃなくて10桁の数字が返るの?