Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SegFault with efraimidis_a_wsample_norep! #877

Open
leoluecken opened this issue Jul 4, 2023 · 0 comments · May be fixed by #879
Open

SegFault with efraimidis_a_wsample_norep! #877

leoluecken opened this issue Jul 4, 2023 · 0 comments · May be fixed by #879
Labels

Comments

@leoluecken
Copy link

Hi, trying to use weighted sampling without replacement, I found a bug. One can crash the REPL, when trying to sample more points than contained in the weights or a vectors

using StatsBase
a = Vector(1:10)
x = Vector(1:100)
wv = ProbabilityWeights(rand(10))
StatsBase.efraimidis_a_wsample_norep!(a, wv, x)

The other function StatsBase.efraimidis_ares_wsample_norep! for the "Efraimidis-Spirakis A-Res algorithm" catches this and fails more gracefully. (What is the difference between these anyway?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants