Skip to content

Commit

Permalink
fix: use rand! in rand for MvGaussianMeanScalePrecision
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimrais committed Oct 22, 2024
1 parent 98f2343 commit fc1103d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ function BayesBase.prod(
end

function BayesBase.rand(rng::AbstractRNG, dist::MvGaussianMeanScalePrecision{T}) where {T}
μ, γ = mean(dist), scale(dist)
return μ + 1 / γ .* randn(rng, T, length(μ))
μ, γ = params(dist)
d = length(μ)
return rand!(rng, dist, Vector{T}(undef, d))
end

function BayesBase.rand(rng::AbstractRNG, dist::MvGaussianMeanScalePrecision{T}, size::Int64) where {T}
Expand Down

0 comments on commit fc1103d

Please sign in to comment.