@Override public String generateName(final IntUnaryOperator randomInRange,final int length){
  if (length == 0) {
    return "LENGTH_WAS_ZERO";
  }
  final StringBuilder sb=new StringBuilder();
  final int initialSequenceIndex=randomInRange.applyAsInt(sequences.size());
  final String initialSequence=sequences.get(initialSequenceIndex);
  sb.append(initialSequence);
  char previous=initialSequence.charAt(0);
  char current=initialSequence.charAt(1);
  for (int i=2; i < length; ++i) {
    final String key=previous + "" + current;
    try {
      final char next=chooseNextCharacter(randomInRange,key);
      sb.append(next);
      previous=current;
      current=next;
    }
 catch (    final NoSuchElementException e) {
      break;
    }
  }
  return formatName(sb.toString());
}

@ Override public String generateName ( final IntUnaryOperator randomInRange , final int length ) { if ( length == 0 ) { return "LENGTH_WAS_ZERO" ; } final StringBuilder sb = new StringBuilder ( ) ; final int initialSequenceIndex = randomInRange . applyAsInt ( sequences . size ( ) ) ; final String initialSequence = sequences . get ( initialSequenceIndex ) ; sb . append ( initialSequence ) ; char previous = initialSequence . charAt ( 0 ) ; char current = initialSequence . charAt ( 1 ) ; for ( int i = 2 ; i < length ; ++ i ) { final String key = previous + "" + current ; try { final char next = chooseNextCharacter ( randomInRange , key ) ; sb . append ( next ) ; previous = current ; current = next ; } catch ( final NoSuchElementException e ) { break ; } } return formatName ( sb . toString ( ) ) ; }
generates a name through the use of a trained markov chain .
