commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (LANG-472) RandomUtils.nextLong() get all even number
Date Sat, 06 Feb 2010 02:43:28 GMT

     [ 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.


Mime
View raw message