Skip to content

Commit

Permalink
Fix MultinomialSampler overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
0 committed Jun 30, 2023
1 parent 25b3149 commit e17caa0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/samplers/multinomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function _rand!(rng::AbstractRNG, s::MultinomialSampler,
x::AbstractVector{<:Real})
n = s.n
k = length(s)
if n^2 > k
if n > sqrt(k)
multinom_rand!(rng, n, s.prob, x)
else
# Use an alias table
Expand Down

0 comments on commit e17caa0

Please sign in to comment.