You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2010/02/04 03:48:27 UTC

[jira] Updated: (LANG-472) RandomUtils.nextLong() get all even number

     [ https://issues.apache.org/jira/browse/LANG-472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated LANG-472:
---------------------------------

    Attachment: LANG-472-alt.patch

Alternative patch which just fixes the issue when n is Long.MAX_VALUE

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