public String generate(int wordsCount,boolean startWithCommon){
  Collection<String> sentences=new LinkedList<String>();
  int totalWords=0;
  String[] words;
  if (startWithCommon) {
    words=Arrays.copyOfRange(COMMON_P,0,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," ");
}

public String generate ( int wordsCount , boolean startWithCommon ) { Collection < String > sentences = new LinkedList < String > ( ) ; int totalWords = 0 ; String [ ] words ; if ( startWithCommon ) { words = Arrays . copyOfRange ( COMMON_P , 0 , 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 , " " ) ; }
generate a paragraph of lorem ipsum
