Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8078672

Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests

    XMLWordPrintable

Details

    • b63

    Backports

      Description

        The tests listed below use an instance of Random initialized as

        Random prng = new Random();

        and do not print the seed as this is in any case impossible to obtain from an instance so created. The suggested fix is create the Random instance in a manner which allows the seed to be printed. A second part of the fix is to allow setting the seed via a Java property such as

        -Dseed=42

         which would be useful in debugging a failure should one occur.

        The affected tests are

        test/java/lang/Double/ParseHexFloatingPoint.java
        test/java/lang/Integer/BitTwiddle.java
        test/java/lang/Long/BitTwiddle.java test/java/lang/RandomSeedFactory.java
        test/java/lang/Math/CubeRootTests.java
        test/java/lang/Math/HypotTests.java
        test/java/lang/Math/IeeeRecommendedTests.java
        test/java/lang/Math/Log1pTests.java

        Note that there are a few other numerics tests under java.lang which use Random with a hard-coded seed of zero and these do not need to be addressed by this issue.

        Attachments

          Issue Links

            Activity

              People

                bpb Brian Burkhalter
                bpb Brian Burkhalter
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Time Tracking

                    Estimated:
                    Original Estimate - 4 hours
                    4h
                    Remaining:
                    Remaining Estimate - 4 hours
                    4h
                    Logged:
                    Time Spent - Not Specified
                    Not Specified