question: public String generateName ( final IntUnaryOperator randomInRange , final int length , int middlesToUse ) { if ( length == 0 ) { return "LENGTH_WAS_ZERO" ; } if ( middles == null ) { middlesToUse = 0 ; } if ( middlesToUse < 0 ) { middlesToUse = 0 ; } final int beginningIndex = randomInRange . applyAsInt ( beginnings . length ) ; final int endingIndex = randomInRange . applyAsInt ( endings . length ) ; final StringBuilder sb = new StringBuilder ( ) ; sb . append ( beginnings [ beginningIndex ] ) ; for ( int i = 0 ; i < middlesToUse ; i ++ ) { final int middleIndex = randomInRange . applyAsInt ( middles . length ) ; sb . append ( middles [ middleIndex ] ) ; } sb . append ( endings [ endingIndex ] ) ; if ( length >= 0 && length <= sb . length ( ) ) { return sb . substring ( 0 , length ) ; } else { return sb . toString ( ) ; } }
target:  Randomly generates a name with one beginning, zero or more middles, and one ending. If no middles have been loaded, then they are ignored and a name is generated without them.