Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShuffleBag{T}"/> class.
        /// </summary>
        /// <param name="randomNumberGenerator">The source of random numbers that will be used to perform the shuffle.</param>
        /// <param name="list">The list of values that will be shuffled.</param>
        /// <param name="offset">The index where shuffling will begin at.</param>
        /// <param name="count">The number of elements that will be shuffled.</param>
        private ShuffleBag(IRandomNumberGenerator randomNumberGenerator, IList <T> list, int offset, int count)
        {
            if (list.IsNull())
            {
                throw new ArgumentNullException(paramName: nameof(list));
            }

            if (randomNumberGenerator.IsNull())
            {
                throw new ArgumentNullException(paramName: nameof(randomNumberGenerator));
            }

            m_count    = count;
            m_list     = list;
            m_offset   = offset;
            m_position = (offset + count);
            m_randomNumberGenerator = randomNumberGenerator;
        }