Fix #3804, #3808
Also add rand(Float64, ...) and rand(Float32, ...)