public static String text ( int minSize , int maxSize ) { maxSize = Math . max ( minSize , maxSize ) ; int size = RandomInteger . nextInteger ( minSize , maxSize ) ; StringBuilder result = new StringBuilder ( ) ; result . append ( RandomString . pick ( _allWords ) ) ; while ( result . length ( ) < size ) { String next = RandomString . pick ( _allWords ) ; if ( RandomBoolean . chance ( 4 , 6 ) ) next = " " + next . toLowerCase ( ) ; else if ( RandomBoolean . chance ( 2 , 5 ) ) next = RandomString . pickChar ( ":,-" ) + next . toLowerCase ( ) ; else if ( RandomBoolean . chance ( 3 , 5 ) ) next = RandomString . pickChar ( ":,-" ) + " " + next . toLowerCase ( ) ; else next = RandomString . pickChar ( ".!?" ) + " " + next ; result . append ( next ) ; } return result . toString ( ) ; }
Generates a random text consisting of first names last names colors stuffs adjectives verbs and punctuation marks .