StatsBase.jl icon indicating copy to clipboard operation
StatsBase.jl copied to clipboard

`sample` fails to throw error for inconsistent lengths

Open ParadaCarleton opened this issue 2 years ago • 1 comments

julia> rng = Xoshiro(1776)

julia> x
10-element Vector{Float64}:
 0.4552384158732863
 0.5476424498276177
 0.7733535276924052
 0.9405848223512736
 0.02964765308691042
 0.74694291453392
 0.7468008914093891
 0.9766699015845924
 0.08694684883050086
 0.35149138733595564

julia> sample(rng, x, pweights(0:10))  # pweights has length=11
0.74694291453392

ParadaCarleton avatar Jun 27 '23 01:06 ParadaCarleton

This is related to #877 - may lead to segfault as well, if sampling more often.

leoluecken avatar Jul 05 '23 09:07 leoluecken