Is there any cpp's equivalent of the randsample in Matlab. The function randsample in Matlab is as follows:
y = randsample(n,k,true,w)
which returns a weighted sample taken with replacement, using a vector of positive weights w, whose length is n. The probability that the integer i is selected for an entry of y is w(i)/sum(w).
for example:
R = randsample('ACGT', 10,true,[0.15 0.35 0.35 0.15])
will have an output
CTTCGTCGGG
If there is no existing cpp lib having the same function as randsample in Matlab, how to write the equivalent function in cpp?