Please Forward: Ruby Quiz Submission

From: "Linklater, Lloyd \(IT\)" <LINKLLL@voughtaircraft.com>
Date: June 6, 2007 1:05:08 PM CDT
To: <submission@rubyquiz.com>
Subject: Please Forward: Ruby Quiz Submission

ok. oops! The reverses are very important. Here is a fix. I was giving the worst pick not the best. heh

ar = Array.new
stats = Array.new
bestStats = Array.new
10_000.times do |k|
  6.times do |j|
    4.times {|i| ar[i] = rand(6)}
    ar.sort!
    stats[j] = ar[1] + ar[2] + ar[3] + 3
  end
  bestStats[k] = stats.sort.reverse
end
bestStats.sort!.reverse!
p bestStats[0]

···

Begin forwarded message: