public static String generatePassphrase ( final String delimiter , final int words , final Dictionary dictionary ) { String result = "" ; final SecureRandom rnd = new SecureRandom ( ) ; final int high = dictionary . getSortedDictionary ( ) . size ( ) ; for ( int i = 1 ; i <= words ; i ++ ) { result += dictionary . getSortedDictionary ( ) . get ( rnd . nextInt ( high ) ) ; if ( i < words ) { result += delimiter ; } } return result ; }
Generates a passphrase from the supplied dictionary with the requested word count .