Originally Posted by
wolle
Maybe you mean duplicates? Do you want to avoid them? One method is to add each new random number to an std::vector after making sure it is not already in there. Another method is to add the random numbers to a data structure that rejects duplicates, for example, an std::set or an std:: unordered_set. This is fast but the random order of the random numbers gets lost. It can be fixed using std::random_shuffle.
Note that for your first loop to iterate 100 times and the second 50 times, either the loop variables must start at 0, or the < signs must be <=.