Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-472

RandomUtils.nextLong() get all even number

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: lang.math.*
    • Labels:
      None
    • Environment:

      all system

      Description

      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"); }

      }

        Attachments

        1. LANG-472-alt.patch
          2 kB
          Niall Pemberton
        2. lang-472.patch
          2 kB
          Phil Steitz

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kaqi072821 zhangruimin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: