From: James Edward Gray II Date: 2007-06-07T07:06:27+09:00 Subject: Fwd: Please Forward: Ruby Quiz Submission Begin forwarded message: > From: "Linklater, Lloyd \(IT\)" > Date: June 6, 2007 1:11:09 PM CDT > To: > Subject: Please Forward: Ruby Quiz Submission > > Ok, I know that this has got to be annoying, but it is my first > time and I just had to ask. Is this a better way to do it? > > ar = Array.new > stats = Array.new > bestStats = Array.new > 10_000.times do |k| > 6.times do |j| > ar = [rand(6), rand(6), rand(6), rand(6)].sort > stats[j] = ar[1] + ar[2] + ar[3] + 3 > end > bestStats[k] = stats.sort.reverse > end > p bestStats.sort.reverse[0] > > OK. Even if I think of a super improvement, I will keep it to > myself. Thanks again! > > Lloyd Linklater >