Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 92300 invoked from network); 6 Feb 2010 02:43:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Feb 2010 02:43:50 -0000 Received: (qmail 68778 invoked by uid 500); 6 Feb 2010 02:43:49 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 68549 invoked by uid 500); 6 Feb 2010 02:43:49 -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 68532 invoked by uid 99); 6 Feb 2010 02:43:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Feb 2010 02:43:48 +0000 X-ASF-Spam-Status: No, hits=-1999.6 required=10.0 tests=ALL_TRUSTED,SUBJECT_FUZZY_TION X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Feb 2010 02:43:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0C51429A001E for ; Fri, 5 Feb 2010 18:43:28 -0800 (PST) Message-ID: <1780302717.93561265424208049.JavaMail.jira@brutus.apache.org> Date: Sat, 6 Feb 2010 02:43:28 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Subject: [jira] Resolved: (LANG-472) RandomUtils.nextLong() get all even number In-Reply-To: <258577176.1227670364647.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sebb resolved LANG-472. ----------------------- Resolution: Fixed Fix Version/s: (was: 2.x) 2.5 The behaviour of nextLong(long) has been fixed by adapting the nextInt(int) code from Harmony's Random class: URL: http://svn.apache.org/viewvc?rev=907160&view=rev Log: Revert nextInt() and nextLong() to 2.4 behaviour, i.e MAX_VALUE is not included Rewrite nextLong(long) based on Harmony's implementation of nextInt(int) Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java > RandomUtils.nextLong() get all even number > ------------------------------------------ > > Key: LANG-472 > URL: https://issues.apache.org/jira/browse/LANG-472 > Project: Commons Lang > Issue Type: Bug > Components: lang.math.* > Environment: all system > Reporter: zhangruimin > Fix For: 2.5 > > Attachments: LANG-472-alt.patch, lang-472.patch > > > when we use the following code , we can see that the method produce only even number. > while (true) { > // for (int i = 0; i < 100; i++) { > if (RandomUtils.nextLong() % 2 == 1) { > System.out.println("ok"); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.