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

    • b63

        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.

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

                Created:
                Updated:
                Resolved:

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