   Random name generator
  Hi all, I am creating a random name generator, and its going well so far.However, I want to have unique names.The problem is, the more names I create, the higher amount of duplicates are being generated. Is there a simple way too keep iterating until you have a full array of unique names ? I wrote a function which checks for duplicate names, and when generating 8K names I have somewhere between 100-200 duplicates.If needed, ill post my code, but I don't think its needed since its more of a theory question.   
  Use a set structure like C++'s std::set class or Python's set object and add names to the set until it reaches the size you want.   ;  why would that not create duplicates then? o.O   ;Quote:Original post by Dieseltjuhwhy would that not create duplicates then? o.OA set, by definition, doesn't contain duplicates. So you randomly generate the name, add it to the set, and repeat until the set reaches a particular size.The duplicates are still created, but the set will contain only the unique names.   ;Quote:Original post by SiCraneUse a set structure like C++'s std::set class or Python's set object and add names to the set until it reaches the size you want.You just have to make sure the size is less than the maximum number of unique values that can be generated by your RNG, otherwise it will never fill up :)   