D
d c
hi -
can someone help with suggesting what is wrong below? i am trying to
add a simple method to array#random
but get the wrong number of args error...
have tried lots of variations!
from (irb):14:in `rand'
from (irb):14:in `random'
from (irb):18=> 2
tx
/dc
can someone help with suggesting what is wrong below? i am trying to
add a simple method to array#random
but get the wrong number of args error...
have tried lots of variations!
ArgumentError: wrong number of arguments (1 for 0)class Array
def random
n = rand(self.size.to_i)
return self[n]
end
end => nil
[1, 2, 3].random
from (irb):14:in `rand'
from (irb):14:in `random'
from (irb):18=> 2
tx
/dc