enable rand(::AbstractArray, [dims])

This is a rewrite of 6d329ce, 9d0282e and d9814ff (from #8309,
which was reverted).
Merge pull request #9049 from JuliaLang/rf/rand-abstractarray

enable rand(::AbstractArray, [dims]) (take 3)