You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, using sample function with many samples returns a vector with all the sample results. I might be overlooking the documents, but I'm looking for a way to "consume" each sample result in-place without building the resulting vector, while still enjoying the benefit of preprocessing. My use case is similar to the following:
nitems =100
nsamples =10000
w =Weights(rand(nitems))
counts =zeros(nitems)
# Is it possible to not generate the 10000-element intermediate vector?for eachsample insample(1:nitems, w, nsamples)
counts[eachsample] +=1end# Alternatively, this seems not to utilize preprocessing.for _ in1:nsamples
counts[sample(1:nitems, w)] +=1end
Is there a way to achieve it? Thank you!
The text was updated successfully, but these errors were encountered:
Currently, using
sample
function with many samples returns a vector with all the sample results. I might be overlooking the documents, but I'm looking for a way to "consume" each sample result in-place without building the resulting vector, while still enjoying the benefit of preprocessing. My use case is similar to the following:Is there a way to achieve it? Thank you!
The text was updated successfully, but these errors were encountered: