David Collier wrote:
>>> class Array
>>>   def random
>>>     n = rand(self.size.to_i)
>>>     return self[n]
>>>   end
>>> end
> => nil
>>> [1, 2, 3].random
> ArgumentError: wrong number of arguments (1 for 0)
>   from (irb):14:in `rand'

Did you by any chance alias random to rand in Array? If so then that 
would be the reason.
Anyway, maybe you can use this one, it's what I use for Array#random:

class Array
  # Get a random element of this array
  # With an argument it gets you n elements without any index used more 
than once
  def random(n=nil)
    unless n then
      at(rand(length))
    else
      raise ArgumentError unless Integer === n and n.between?(0,length)
      ary = dup
      l   = length
      n.times { |i|
        r = rand(l-i)+i
        ary[r], ary[i] = ary[i], ary[r]
      }
      ary.first(n)
    end
  end
end

-- 
Posted via http://www.ruby-forum.com/.