From: "Linklater, Lloyd \(IT\)" <LINKLLL@voughtaircraft.com>
Date: June 6, 2007 1:11:09 PM CDT
To: <submission@rubyquiz.com>
Subject: Please Forward: Ruby Quiz SubmissionOk, 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
···
Begin forwarded message: