Given a range [0, n] and a number k. The goal is to randomly choose k integers in the range where repetition is allowed in C++. For example, if n=5 and k=3 one possible set is 2, 2, 3
C++ randomly sample k numbers from range 0:n-1 (n > k) without replacement
This link only provides without replacement, but I need to figure out with replacement. Thanks!
New contributor
anakin105 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.