<commit_before>﻿using System;
using System.Collections.Generic;

namespace MoreLinq
{
    public static partial class MoreEnumerable
    {
        /// <summary>
        /// Repeats the specific sequences <paramref name="repeatCount"/> times.
        /// </summary>
        /// <param name="sequence">The sequence to repeat</param>
        /// <param name="repeatCount">Number of times to repeat the sequence</param>
        /// <returns>A sequence produced from the repetition of the original source sequence</returns>
        public static IEnumerable<T> Repeat<T>(this IEnumerable<T> sequence, int repeatCount)
        {
            sequence.ThrowIfNull("sequence");
            if (repeatCount < 0)
                throw new ArgumentOutOfRangeException("repeatCount", "Repeat count must be >= 0");
            return RepeatImpl(sequence, repeatCount);
        }

        private static IEnumerable<T> RepeatImpl<T>(this IEnumerable<T> sequence, int repeatCount)
        {
            while (repeatCount-- > 0)
            {
                foreach (var item in sequence)
                    yield return item;
            }
        }
    }
}<commit_msg>Improving Repeat exception message when repeat count is out of range<commit_after>﻿using System;
using System.Collections.Generic;

namespace MoreLinq
{
    public static partial class MoreEnumerable
    {
        /// <summary>
        /// Repeats the specific sequences <paramref name="repeatCount"/> times.
        /// </summary>
        /// <param name="sequence">The sequence to repeat</param>
        /// <param name="repeatCount">Number of times to repeat the sequence</param>
        /// <returns>A sequence produced from the repetition of the original source sequence</returns>
        public static IEnumerable<T> Repeat<T>(this IEnumerable<T> sequence, int repeatCount)
        {
            sequence.ThrowIfNull("sequence");
            if (repeatCount < 0)
                throw new ArgumentOutOfRangeException("repeatCount", "Repeat count must be greater than or equal to zero.");
            return RepeatImpl(sequence, repeatCount);
        }

        private static IEnumerable<T> RepeatImpl<T>(this IEnumerable<T> sequence, int repeatCount)
        {
            while (repeatCount-- > 0)
            {
                foreach (var item in sequence)
                    yield return item;
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.09820309235269536, 'fraction_numerical': 0.002089427496865859, 'mean_word_length': 2.192, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1257904', 'n_tokens_mistral': 591, 'n_tokens_neox': 568, 'n_words': 187}