commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-472) RandomUtils.nextLong() get all even number
Date Thu, 04 Feb 2010 03:50:28 GMT

    [ https://issues.apache.org/jira/browse/LANG-472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829424#action_12829424
] 

Niall Pemberton commented on LANG-472:
--------------------------------------

Just reviewed Sebb's change - RandomUtils.nextLong() is now fixed because it no longer calls
JVMRandom nextLong(Long.MAX_VALUE) - but instead delagates to SHARED_RANDOM.nextLong(). AFAICS
calling JVMRandom nextLong(Long.MAX_VALUE)  will still see the same problem.

Do we want to do anything about this (my nasty hack?)

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