Skip to content

Commit 71c3433

Browse files
committed
Fix rand for MvBinnedDist
1 parent d23264c commit 71c3433

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mv_binned_dist.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function Distributions._rand!(rng::AbstractRNG, d::MvBinnedDist{T,N}, A::Abstrac
101101
u = rand(rng)
102102
i = searchsortedfirst(d._bin_linidx_cdf, u)
103103
idx_lo = CartesianIndices(d._bin_pdf)[i]
104-
idx_hi = idx_lo + CartesianIndex(1, 1)
104+
idx_hi = idx_lo + CartesianIndex(ntuple(i -> 1, Val(N))...)
105105
x_lo = map(getindex, d._edges, idx_lo.I)
106106
x_hi = map(getindex, d._edges, idx_hi.I)
107107
for i in 1:N

0 commit comments

Comments
 (0)