StatsBase.jl
StatsBase.jl copied to clipboard
`wsample(w)` behaves not as the documentation describes it
The doc says
wsample([rng], [a], w)
Select a weighted random sample of size 1 from a with probabilities proportional to the weights given in w. If a is not present, select a random weight from w.
From this, I expect wsample(w) ∈ w. However, I am getting
julia> wsample([1,10])
2
Just passing by: it does look that a sensibile behavior (sampling the weight indices) and a bad documentation. Definitely not a bug.