I think you're making it too complicated.
generated_numbers = 4.times.map{Random.rand(8) } #=> [4, 2, 6, 8]
edit: for a giggle, I put together this function:
def rand_array(x, max) x.times.map{ Random.rand(max) } end puts rand_array(5, 20)
source share