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

RandomUtils.nextLong() get all even number

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.5
    • lang.math.*
    • None
    • 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.patch
          2 kB
          Phil Steitz
        2. LANG-472-alt.patch
          2 kB
          Niall Pemberton

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: