String (int wordsCount, boolean startWithCommon) { Collection<String> sentences = new LinkedList<>(); int totalWords = 0; String[] words; if (startWithCommon) { words = Arrays.copyOf(COMMON_P, Math.min(wordsCount, COMMON_P.length)); if (words.length > 5) { words[4] += ','; } totalWords += words.length; sentences.add(sentence(words, '.')); } while (totalWords < wordsCount) { words = sample(WORDS, Math.min(rand(3, 12) * rand(1, 5), wordsCount - totalWords)); totalWords += words.length; insertCommas(words); sentences.add(sentence(words)); } return StringUtil.join(sentences, " "); }