Github user ameyjadiye commented on a diff in the pull request: https://github.com/apache/commons-text/pull/62#discussion_r140843601 --- Diff: src/main/java/org/apache/commons/text/RandomStringGenerator.java --- @@ -324,6 +324,40 @@ public Builder withinRange(final int minimumCodePoint, final int maximumCodePoin /** * <p> + * Specifies the array of minimum and maximum char allowed in the + * generated string. + * </p> + * + * For example: + * <pre> + * {@code + * char [][] pairs = {{'0','9'}}; + * char [][] pairs = {{'a','z'}}; + * char [][] pairs = {{'a','z'},{'0','9'}}; + * } + * </pre> + * + * @param pairs array of charachters array, expected is to pass min, max pairs through this arg. + * @return {@code this}, to allow method chaining. + */ + public Builder withinRange(final char[] ... pairs) { + characterList = new ArrayList<Character>(); + for (char[] pair : pairs) { + final int minimumCodePoint = pair[0]; + final int maximumCodePoint = pair[1]; --- End diff -- I think we should put that for better exception handling, also check of ```minimumCodePoint < maximumCodePoint ```, thanks
--- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org