private static bool DetectsAny(List <BitArray> selfSet, Lymphocyte lymphocyte) // helper
 {
     for (int i = 0; i < selfSet.Count; ++i)
     {
         if (lymphocyte.Detects(selfSet[i]) == true)
         {
             return(true);
         }
     }
     return(false);
 }
        public static List <Lymphocyte> CreateLymphocyteSet(List <BitArray> selfSet, int numAntibodyBits, int numLymphocytes)
        {
            // crea una lista de linfocitos que no detecta ningún patrón
            List <Lymphocyte>      result   = new List <Lymphocyte>();
            Dictionary <int, bool> contents = new Dictionary <int, bool>();

            while (result.Count < numLymphocytes)
            {
                BitArray   antibody   = RandomBitArray(numAntibodyBits); // random anticuerpo
                Lymphocyte lymphocyte = new Lymphocyte(antibody);        // random linfocito
                int        hash       = lymphocyte.GetHashCode();        // asume la longitud del anticuerpo <= 32 bits

                if (DetectsAny(selfSet, lymphocyte) == false && contents.ContainsKey(hash) == false)
                {
                    result.Add(lymphocyte);
                    contents.Add(hash, true);
                }
            }
            return(result);
        }