test/java/lang/Math/IeeeRecommendedTests.java

Print this page
rev 11823 : 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests
Summary: Add ability to initial the random number generator from the system property "seed" and print to STDOUT the seed value actually used.
Reviewed-by: XXX

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -21,12 +21,15 @@
  * questions.
  */
 
 /*
  * @test
- * @bug 4860891 4826732 4780454 4939441 4826652
- * @summary Tests for IEEE 754[R] recommended functions and similar methods
+ * @library /lib/testlibrary/
+ * @build jdk.testlibrary.*
+ * @run main IeeeRecommendedTests
+ * @bug 4860891 4826732 4780454 4939441 4826652 8078672
+ * @summary Tests for IEEE 754[R] recommended functions and similar methods (use -Dseed=X to set PRNG seed)
  * @author Joseph D. Darcy
  * @key randomness
  */
 
 public class IeeeRecommendedTests {

@@ -44,11 +47,11 @@
     static final double Double_MAX_VALUEmm      = 0x1.ffffffffffffeP+1023;
     static final double Double_MAX_SUBNORMAL    = 0x0.fffffffffffffP-1022;
     static final double Double_MAX_SUBNORMALmm  = 0x0.ffffffffffffeP-1022;
 
     // Initialize shared random number generator
-    static java.util.Random rand = new java.util.Random();
+    static java.util.Random rand = RandomFactory.getRandom();
 
     /**
      * Returns a floating-point power of two in the normal range.
      */
     static double powerOfTwoD(int n) {