Пример #1
0
 private void GenerateRandomLottoNumbers()
 {
     RandomNumbers.Clear();
     while (RandomNumbers.Count < numberOfLottoNumbers)
     {
         int nextNumber = Randomizer.Next(lowerBound, lottoNumberUpperBound + 1);
         while (RandomNumbers.Contains(nextNumber))
         {
             nextNumber = Randomizer.Next(lowerBound, lottoNumberUpperBound + 1);
         }
         RandomNumbers.Add(nextNumber);
     }
 }
Пример #2
0
        private int GetNextEvictionIndex()
        {
            if (RandomNumbers.Count == CurrentIndexInRandomNumbers)
            {
                RandomNumbers.Add(RandomGenerator.Next(0, 10001) / 10000.0);
            }

            var result = (int)Math.Round(RandomNumbers[CurrentIndexInRandomNumbers] * (CacheSize - 1));

            CurrentIndexInRandomNumbers++;

            return(result);
        }