In a code in C++, for each input from the user, I am generating at most 20M unsigned long numbers one by one and checking if they are compatible with the inputs or not. Generated numbers are totally different according to the different inputs, however, I know that at most 10% of them are unique numbers. So, I don't want to recheck the repetitive numbers for the performance aspects as checking numbers is a bit costly in my implementation.
Therefore, I decided to generate and store numbers one by one in a container and check if they are new, to do some other costly processes on them. I have tried many containers in C++, and finally, I found unordered_set the fastest in my particular case, however, it is still too time_concuming. I might be able to find the distribution of the numbers for each input, but I don't know how I can make it faster. Can I use better hash functions or even other containers?
Any recommendation will be appreciated.