Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 381AD200BE1 for ; Mon, 19 Dec 2016 20:47:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 36E0D160B14; Mon, 19 Dec 2016 19:47:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 67C62160B30 for ; Mon, 19 Dec 2016 20:46:59 +0100 (CET) Received: (qmail 23664 invoked by uid 500); 19 Dec 2016 19:46:58 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 23561 invoked by uid 99); 19 Dec 2016 19:46:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Dec 2016 19:46:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 5F5192C03DE for ; Mon, 19 Dec 2016 19:46:58 +0000 (UTC) Date: Mon, 19 Dec 2016 19:46:58 +0000 (UTC) From: "Duncan Jones (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (TEXT-34) Add class to generate random strings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 19 Dec 2016 19:47:00 -0000 [ https://issues.apache.org/jira/browse/TEXT-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15762116#comment-15762116 ] Duncan Jones commented on TEXT-34: ---------------------------------- Thanks for the feedback Emmanuel. It's great you have a real life use case we can examine. One concern I had about adding that functionality was it didn't seem very text-oriented to me. It is essentially selecting random objects from an array; the objects just happen to be {{char}} or {{int}} values. The specific functionality you describe can be achieved with the filters, but I appreciate that was only an example: {code:java} String licence = new RandomStringBuilder().ofLength(20).withMinimum('A').withMaximum('Z') .filteredBy(new CodePointPredicate() { @Override public boolean test(int codePoint) { return codePoint != 'O' && codePoint != 'I'; } }).build(); {code} So, in short, it was a deliberate omission, but I forgot to kick off the discussion about whether it was a good idea! By the way, I'm not suggesting filters are an appropriate substitution for the original functionality. There's no efficient way you can use filters to create an arbitrary collection of characters. I'm questioning whether the original functionality belongs in a text-processing component. > Add class to generate random strings > ------------------------------------ > > Key: TEXT-34 > URL: https://issues.apache.org/jira/browse/TEXT-34 > Project: Commons Text > Issue Type: New Feature > Reporter: Duncan Jones > Assignee: Duncan Jones > > The {{RandomStringUtils}} class will be deprecated in Commons Lang and reborn in Commons Text. > Because the original class has some complicated parameters and potentially unnecessary capabilities, I'll simplify as I move it across. I'll also ensure the class plays nicely with Unicode characters. -- This message was sent by Atlassian JIRA (v6.3.4#6332)