JDK-8078672 : Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2015-04-27
  • Updated: 2016-06-13
  • Resolved: 2015-04-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b63Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
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.
Comments
Review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-April/033058.html
27-04-2015