From: Harry Kakueki Date: 2012-02-04T11:41:06+09:00 Subject: Re: 4 random numbers take highest 3 and add them together. On Sat, Feb 4, 2012 at 9:43 AM, h4y4shi 13bladex wrote: > I want to get 4 random numbers. The numbers will be between 1-6. I want > to disregard the smallest number and add the three biggest numbers > together. So far I wrote some ruby that I thought would do this but I > keep getting an error. > This is a different approach but if it doesn't work, I think it is easier to fix errors if you have them because it is short and easier to read. Once you have your random numbers try something like this. arr = [2,4,1,5] p arr.sort[1..-1].inject{|a,b| a+b} Hope it helps. Harry