[ https://issues.apache.org/jira/browse/LANG-472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829378#action_12829378 ]
Sebb commented on LANG-472: --------------------------- Applied Phil's patch, but adjusted so that the class now uses a static Random() instance for all random number generation. URL: http://svn.apache.org/viewvc?rev=906318&view=rev Log: LANG-472 - RandomUtils.nextLong() get all even number Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/math/RandomUtilsTest.java I suspect nextLong(long) probably does not generate very evenly distributed numbers. Also documented non-negative behaviour: URL: http://svn.apache.org/viewvc?rev=906319&view=rev Log: LANG-472 - Document >=0 behaviour 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.x > > Attachments: 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.