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

namespace ExtraLINQ.Internals
{
    internal class CollectionElementsPicker<TSource>
    {
        private readonly IEnumerable<TSource> _source;
        private readonly Random _randomNumberGenerator;

        public CollectionElementsPicker(IEnumerable<TSource> source)
        {
            _source = source;
            _randomNumberGenerator = new Random();
        }

        public TSource PickRandomElement()
        {
            return PickRandomElement(_randomNumberGenerator);
        }

        public TSource PickRandomElement(Random randomNumberGenerator)
        {
            int itemCount = _source.Count();
            int randomIndex = randomNumberGenerator.Next(itemCount);
            TSource randomItem = _source.ElementAt(randomIndex);

            return randomItem;
        }

        public IEnumerable<TSource> PickRandomElements(int randomElementsCount)
        {
            CollectionShuffler<TSource> shuffler = new CollectionShuffler<TSource>(_source);
            IEnumerable<TSource> shuffledCollection = shuffler.ShuffleCollection();<commit_msg>fixed wrong method overload selection error<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace ExtraLINQ.Internals
{
    internal class CollectionElementsPicker<TSource>
    {
        private readonly IEnumerable<TSource> _source;
        private readonly Random _randomNumberGenerator;

        public CollectionElementsPicker(IEnumerable<TSource> source)
        {
            _source = source;
            _randomNumberGenerator = new Random();
        }

        public TSource PickRandomElement()
        {
            return PickRandomElement(_randomNumberGenerator);
        }

        public TSource PickRandomElement(Random randomNumberGenerator)
        {
            int itemCount = _source.Count();
            int randomIndex = randomNumberGenerator.Next(itemCount);
            TSource randomItem = _source.ElementAt(randomIndex);

            return randomItem;
        }

        public IEnumerable<TSource> PickRandomElements(int randomElementsCount)
        {
            return PickRandomElements(randomElementsCount, _randomNumberGenerator);
        }

        public IEnumerable<TSource> PickRandomElements(int randomElementsCount, Random randomNumberGenerator)
        {
            CollectionShuffler<TSource> shuffler = new CollectionShuffler<TSource>(_source);
            IEnumerable<TSource> shuffledCollection = shuffler.ShuffleCollection(randomNumberGenerator);
{'fraction_non_alphanumeric': 0.06432973805855162, 'fraction_numerical': 0.0, 'mean_word_length': 2.8877245508982035, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '3392797', 'n_tokens_mistral': 613, 'n_tokens_neox': 602, 'n_words': 129}