On Sat, Feb 4, 2012 at 9:43 AM, h4y4shi 13bladex
<serpentinexcubed / gmail.com> 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