<commit_before>﻿using Ploeh.AutoFixture.Kernel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ploeh.AutoFixture
{
    /// <summary>
    /// Draws a random element from the given collection
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public sealed class ElementsBuilder<T> : ISpecimenBuilder
    {
        private readonly ICollection<T> elements;
        private readonly RandomNumericSequenceGenerator sequence;

        /// <summary>
        /// Initializes a new instance of the <see cref="ElementsBuilder<T>"/> class.
        /// </summary>
        /// <param name="elements">The collection from which elements should be drawn from.
        /// It must contain at least two element.</param>
        public ElementsBuilder(ICollection<T> elements)
        {
            if (elements == null)
                throw new ArgumentNullException(nameof(elements));

            if (elements.Count < 2)
                throw new ArgumentException("The collection must contain at least two elements.", nameof(elements));

            this.elements = elements;
            this.sequence = new RandomNumericSequenceGenerator(0, elements.Count - 1);
        }

        /// <summary>
        /// Returns one of the element present in the collection given when the object was constructed.
        /// </summary>
        /// <param name="request">The request that describes what to create.</param>
        /// <param name="context">Not used.</param>
        /// <returns>
        /// One of the element present in the collection given to the constructor if <paramref name="request"/>
        /// is a request for <typeparamref name="T"/>; otherwise, a <see cref="NoSpecimen"/> instance.
        /// </returns>
        public object Create(object request, ISpecimenContext context)
        {
            if (!typeof(T).Equals(request))
                return new NoSpecimen();

            return this.elements.ElementAt(this.GetNext());
        }<commit_msg>Fixing XML comment, one more try<commit_after>﻿using Ploeh.AutoFixture.Kernel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ploeh.AutoFixture
{
    /// <summary>
    /// Draws a random element from the given collection
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public sealed class ElementsBuilder<T> : ISpecimenBuilder
    {
        private readonly ICollection<T> elements;
        private readonly RandomNumericSequenceGenerator sequence;

        /// <summary>
        /// Initializes a new instance of the <see cref="ElementsBuilder{T}"/> class.
        /// </summary>
        /// <param name="elements">The collection from which elements should be drawn from.
        /// It must contain at least two element.</param>
        public ElementsBuilder(ICollection<T> elements)
        {
            if (elements == null)
                throw new ArgumentNullException(nameof(elements));

            if (elements.Count < 2)
                throw new ArgumentException("The collection must contain at least two elements.", nameof(elements));

            this.elements = elements;
            this.sequence = new RandomNumericSequenceGenerator(0, elements.Count - 1);
        }

        /// <summary>
        /// Returns one of the element present in the collection given when the object was constructed.
        /// </summary>
        /// <param name="request">The request that describes what to create.</param>
        /// <param name="context">Not used.</param>
        /// <returns>
        /// One of the element present in the collection given to the constructor if <paramref name="request"/>
        /// is a request for <typeparamref name="T"/>; otherwise, a <see cref="NoSpecimen"/> instance.
        /// </returns>
        public object Create(object request, ISpecimenContext context)
        {
            if (!typeof(T).Equals(request))
                return new NoSpecimen();

            return this.elements.ElementAt(this.GetNext());
        }
{'fraction_non_alphanumeric': 0.11319358816276202, 'fraction_numerical': 0.0014796547472256474, 'mean_word_length': 2.3137254901960786, 'pattern_counts': {'":': 0, '<': 52, '<?xml version=': 0, '>': 50, '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': '953157', 'n_tokens_mistral': 998, 'n_tokens_neox': 976, 'n_words': 333}