Is there a function in Java like the randsample
in Matlab which can return weighted samples(sampled uniformly at random with replacement, and having a weight- w[i]
for each number. The probability that a number i is selected is w(i)/sum(w).)?
I want to use something like this
randsample([0 1],1,true,[0.2 0.8]);