Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 37355 invoked from network); 12 May 2003 17:35:13 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 12 May 2003 17:35:13 -0000 Received: (qmail 10839 invoked by uid 97); 12 May 2003 17:37:20 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 10832 invoked from network); 12 May 2003 17:37:20 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 12 May 2003 17:37:20 -0000 Received: (qmail 37079 invoked by uid 500); 12 May 2003 17:35:11 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 33387 invoked from network); 12 May 2003 17:31:18 -0000 Message-ID: <000801c318ac$c26a6520$9d1729d9@oemcomputer> From: "Stephen Colebourne" To: "Jakarta Commons Developers List" Subject: Fw: RandomStringUtils Bug Date: Mon, 12 May 2003 18:34:35 +0100 Organization: Joda.org MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ----- Original Message ----- From: To: Sent: Monday, May 12, 2003 3:53 PM Subject: RandomStringUtils Bug > Hi Stephen, > > may I suggest to change the Code to the method random: > > public static String random(int count, char[] set) > { > return random(count, 0, set.length, false, false, set); > } > > The change is not to subtract 1 from set.length. It happens to me > that, based on your implementation, the highest char of the array never > got chosen. > > E.g. > > String s = RandomStringUtils.random(25,"abc123"); > System.out.println(s); > > used to produce > > acaa2bbcb2211a2a2b22a21ab > 2aac2cc2211b22babbbcc12ab > bc11c1aba21caabc1bcbaa1ac > > You may notice that there is no character '3' in it. > > After my change I get > > 11222233c2abcbacbbc1ba2cb > ba1aaa2c2aa1112bb331c1332 > 32aaa333123312b2baaacacb1 > > > Hope this is for use for you. > > > Roman > > > -- > ________________________________________________________________________ > Roman Seibold, Dipl.-Inform. > Haenchen & Partner, Beratungsgesellschaft fuer Wirtschaftsinformatik mbH > Calwer Str. 1, 71034 Boeblingen, Germany > > Roman.Seibold(at)haenchen.softwarezentrum.de > http://www.haenchen.softwarezentrum.de > Phone: +49 (0)7031 2126 100 > FAX: +49 (0)7031 2126 199 > ________________________________________________________________________ --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org