Exemplo n.º 1
0
        private string[] InitializePool(SentenceSourceSettings settings)
        {
            var sentences = new string[settings.SentencesPoolSize];

            var currentSize = 0;

            while (currentSize < settings.SentencesPoolSize)
            {
                var words = _wordsSource.GetWords(GetRandom(1, settings.MaxWordsNumber)).ToList();
                words[0] = FirstCharToUpper(words[0]);

                sentences[currentSize] = string.Join(' ', words);
                currentSize++;
            }

            return(sentences);
        }
Exemplo n.º 2
0
 public DefaultSentencesSource(IWordsSource wordsSource, SentenceSourceSettings settings)
 {
     _random        = new Random(DateTime.UtcNow.Millisecond);
     _wordsSource   = wordsSource;
     _sentencesPool = InitializePool(settings);
 }