Esempio n. 1
0
        public void Init()
        {
            var r = new Random(4);

            _keys = new List <T>();

            for (int i = 0; i < Count; ++i)
            {
                _keys.Add(DictionariesBase <T> .GenerateValue(r));
            }

            int n = _keys.Count;

            while (n > 1)
            {
                n--;
                int k     = r.Next(n + 1);
                var value = _keys[k];
                _keys[k] = _keys[n];
                _keys[n] = value;
            }
        }
        public void Init2()
        {
            var r = new Random(4);

            _list = new List <KeyValuePair <T, int> >();

            for (int i = 0; i < Count; ++i)
            {
                _list.Add(new KeyValuePair <T, int>(DictionariesBase <T> .GenerateValue(r), i));
            }

            int n = _list.Count;

            while (n > 1)
            {
                n--;
                int k     = r.Next(n + 1);
                var value = _list[k];
                _list[k] = _list[n];
                _list[n] = value;
            }
        }