Sampling Multiple samples from NormalInverseGamma distribution

Hi,

I’m trying to sample multiple samples from a NormalInversaGamma distribution. I was using rand() function with two arguments, but is getting the following error:

julia> using ConjugatePriors
julia> D = ConjugatePriors.NormalInverseGamma( 0.00, 1.0/0.01, 1.0, 1.0  )
ConjugatePriors.NormalInverseGamma{Float64}(mu=0.0, v0=100.0, shape=1.0, scale=1.0)

julia> rand( D, 4 )
ERROR: MethodError: Cannot `convert` an object of type Tuple{Float64,Float64} to an object of type Float64
This may have arisen from a call to the constructor Float64(...),
since type constructors fall back to convert methods.
Stacktrace:
 [1] _rand!(::ConjugatePriors.NormalInverseGamma{Float64}, ::Array{Float64,1}) at /home/vish/.julia/v0.6/Distributions/src/genericrand.jl:37
 [2] rand(::ConjugatePriors.NormalInverseGamma{Float64}, ::Int64) at /home/vish/.julia/v0.6/Distributions/src/univariates.jl:182

I think the problem is because NIG gives a sample vector (tuple actually), rand() is getting confused to convert it to a Float64 entry. Why cannot rand() return a vector of tuples in this case?

With Regards,
Vishnu Raj

This seems to be a known issue:
https://github.com/JuliaStats/ConjugatePriors.jl/issues/19
If the package is maintained, perhaps a trivial PR would help?

Distributions has much better support for other types than Int, Float64 and Vector{Float64} by now, maybe it is really not so difficult. A PR would be very welcome.