test/java/lang/Double/ParseHexFloatingPoint.java

Print this page
rev 11813 : 8078586: java/lang/Double/ParseHexFloatingPoint.java fails intermittently
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, 2011, 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,18 +21,16 @@
  * questions.
  */
 
 /*
  * @test
- * @bug 4826774
+ * @library ..
+ * @bug 4826774 8078586
  * @summary Numerical tests for hexadecimal inputs to parseDouble, parseFloat
  * @author Joseph D. Darcy
  */
 
-
-import java.util.regex.*;
-
 public class ParseHexFloatingPoint {
     private ParseHexFloatingPoint(){}
 
     public static final double infinityD = Double.POSITIVE_INFINITY;
     public static final double NaND = Double.NaN;

@@ -253,11 +251,12 @@
         }
 
         failures += significandAlignmentTests();
 
         {
-            java.util.Random rand = new java.util.Random();
+            long seed = RandomSeedFactory.getSeed();
+            java.util.Random rand = new java.util.Random(seed);
             // Consistency check; double => hexadecimal => double
             // preserves the original value.
             for(int i = 0; i < 1000; i++) {
                 double d = rand.nextDouble();
                 failures += testCase(Double.toHexString(d), d);