question: public String generateCode ( CodeGeneratorSource alphabet , int length ) { Reject . ifTrue ( length < 1 ) ; Reject . ifNull ( alphabet ) ; StringBuilder codeBuilder = new StringBuilder ( length ) ; String chars = alphabet . getChars ( ) ; for ( int k = 0 ; k < length ; k ++ ) { codeBuilder . append ( chars . charAt ( secureRandom . nextInt ( chars . length ( ) ) ) ) ; } return codeBuilder . toString ( ) ; }
target:  Generates a code of the supplied length, using the provided alphabet as its source of random characters.