Is there is any function to generate random numbers excluding those which were previously selected?
Asked
Active
Viewed 43 times
2
-
Short answer: No. SUGGESTION: If "uniqueness" is important to you, save the random numbers you get in [std::set](https://en.cppreference.com/w/cpp/container/set) and use `find()` or `count()` to see if you already selected that number. – paulsm4 Aug 04 '21 at 01:57
-
1duplicates: [C++ random number generator without repeating numbers](https://stackoverflow.com/q/4111214/995714), [C++ No-repeat random number generator](https://stackoverflow.com/q/48290529/995714), [Generating random non repeating number array in C++](https://stackoverflow.com/q/25878202/995714), [Random array generation with no duplicates](https://stackoverflow.com/q/20734774/995714) – phuclv Aug 04 '21 at 01:59