Ejemplo n.º 1
0
 private static TDictionary PopulateDictionary <TDictionary>(TDictionary dictionary)
     where TDictionary : IDictionary <Key, int>
 {
     for (int i = 0; i != Count; ++i)
     {
         // 269th prime.
         int value = 1723 * i % Count;
         var key   = Key.FromBinary(value);
         dictionary ![key] = value;
Ejemplo n.º 2
0
        private static int PopulateDictionary <TDictionary>(TDictionary dictionary)
            where TDictionary : IDictionary <Key, int>
        {
            for (int i = 0; i != Count; ++i)
            {
                int firstValue = (7 + 1723 * i) % Count;
                var firstKey   = Key.FromBinary(firstValue);
                if (!dictionary !.ContainsKey(firstKey))
                {
                    dictionary.Add(firstKey, firstValue);
                }

                int secondValue = (13 + 853 * i) % Count;
                var secondKey   = Key.FromBinary(secondValue);
                dictionary[secondKey] = secondValue;
            }

            return(dictionary !.Count);
        }