From 933a7765d9d81e8f8aebc8fadfab99a91f9d0a0b Mon Sep 17 00:00:00 2001 From: Shiv Shah Date: Mon, 18 May 2026 02:46:27 +0000 Subject: [PATCH] 8317124: use reproducible random in HotSpot tests Reviewed-by: lmesnik, epavlova --- .../c2/cmove/TestScalarConditionalMoveCmpObj.java | 4 +++- .../jtreg/compiler/c2/gvn/TestBoolNodeGVN.java | 5 ++++- .../TestMoveConvI2LOrCastIIThruAddIs.java | 6 ++++-- .../jtreg/compiler/gallery/NormalMapping.java | 5 +++-- .../compiler/hotcode/StressHotCodeCollector.java | 5 ++++- .../intrinsics/float16/Binary16ConversionNaN_2.java | 6 ++++-- ...TestPartialPeelAtUnsignedTestsNegativeLimit.java | 13 +++++++++++-- .../loopopts/superword/TestLargeCompilation.java | 7 +++++-- .../compiler/vectorapi/TestVectorMaskTrueCount.java | 3 ++- .../vectorization/TestRoundVectorDoubleRandom.java | 5 +++-- .../vectorization/TestRoundVectorFloatAll.java | 6 ++++-- .../vectorization/TestRoundVectorFloatRandom.java | 5 +++-- .../Metaspace/elastic/AllocationProfile.java | 5 +++-- .../Metaspace/elastic/TestMetaspaceAllocation.java | 2 ++ .../jtreg/runtime/NMT/NMTInitializationTest.java | 9 +++++++-- 15 files changed, 62 insertions(+), 24 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/cmove/TestScalarConditionalMoveCmpObj.java b/test/hotspot/jtreg/compiler/c2/cmove/TestScalarConditionalMoveCmpObj.java index 63d6f6fba7f..78a364e1f59 100644 --- a/test/hotspot/jtreg/compiler/c2/cmove/TestScalarConditionalMoveCmpObj.java +++ b/test/hotspot/jtreg/compiler/c2/cmove/TestScalarConditionalMoveCmpObj.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2025, Rivos Inc. All rights reserved. + * Copyright (c) 2026, 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 @@ -30,6 +31,7 @@ import jdk.test.lib.Utils; /* * @test + * @key randomness * @summary Test conditional move + compare object. * @library /test/lib / * @run driver ${test.main.class} @@ -300,7 +302,7 @@ public class TestScalarConditionalMoveCmpObj { for (int i = 0; i < a.length; i++) { b[i] = a[i]; } - Random rand = new Random(); + Random rand = Utils.getRandomInstance(); for (int i = 0; i < SIZE; i++) { if (rand.nextInt(5) == 0) { Object t = b[i]; diff --git a/test/hotspot/jtreg/compiler/c2/gvn/TestBoolNodeGVN.java b/test/hotspot/jtreg/compiler/c2/gvn/TestBoolNodeGVN.java index 384dc6f8f11..253e1501cbe 100644 --- a/test/hotspot/jtreg/compiler/c2/gvn/TestBoolNodeGVN.java +++ b/test/hotspot/jtreg/compiler/c2/gvn/TestBoolNodeGVN.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2024 Red Hat and/or its affiliates. All rights reserved. + * Copyright (c) 2026, 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 @@ -26,9 +27,11 @@ package compiler.c2.gvn; import compiler.lib.ir_framework.*; import java.util.Random; +import jdk.test.lib.Utils; /** * @test + * @key randomness * @bug 8327381 * @summary Refactor boolean node tautology transformations * @library /test/lib / @@ -139,7 +142,7 @@ public class TestBoolNodeGVN { private static void testCorrectness() { int[] values = { -100, -42, -16, -8, -5, -1, 0, 1, 5, 8, 16, 42, 100, - new Random().nextInt(), Integer.MAX_VALUE, Integer.MIN_VALUE + Utils.getRandomInstance().nextInt(), Integer.MAX_VALUE, Integer.MIN_VALUE }; for (int x : values) { diff --git a/test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LOrCastIIThruAddIs.java b/test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LOrCastIIThruAddIs.java index c4c6a27cb7d..df2c4bd2558 100644 --- a/test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LOrCastIIThruAddIs.java +++ b/test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LOrCastIIThruAddIs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, 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 @@ -25,10 +25,12 @@ package compiler.conversions; import java.util.Objects; import java.util.Random; +import jdk.test.lib.Utils; import jdk.test.lib.Asserts; /* * @test + * @key randomness * @bug 8254317 8256730 * @requires vm.compiler2.enabled * @summary Exercises the optimization that moves integer-to-long conversions @@ -157,7 +159,7 @@ public class TestMoveConvI2LOrCastIIThruAddIs { // We use a random number generator to avoid constant propagation in C2 // and produce a variable ("a" in the different tests) with a finite, // small value range. - Random rnd = new Random(); + Random rnd = Utils.getRandomInstance(); switch(args[0]) { case "functional": // Small, functional tests. diff --git a/test/hotspot/jtreg/compiler/gallery/NormalMapping.java b/test/hotspot/jtreg/compiler/gallery/NormalMapping.java index 100f4ebaaea..e92254fc675 100644 --- a/test/hotspot/jtreg/compiler/gallery/NormalMapping.java +++ b/test/hotspot/jtreg/compiler/gallery/NormalMapping.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, 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 @@ -33,6 +33,7 @@ import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; import java.io.IOException; import java.util.Random; +import jdk.test.lib.Utils; import javax.swing.JPanel; import java.awt.Font; @@ -78,7 +79,7 @@ import java.util.Arrays; * - MyDrawingPanel: drawing all the parts to the screen. */ public class NormalMapping { - public static Random RANDOM = new Random(); + public static Random RANDOM = Utils.getRandomInstance(); // Increasing this number will make the demo slower. public static final int NUMBER_OF_LIGHTS = 5; diff --git a/test/hotspot/jtreg/compiler/hotcode/StressHotCodeCollector.java b/test/hotspot/jtreg/compiler/hotcode/StressHotCodeCollector.java index 4a7f9d2cc21..b107df8fa46 100644 --- a/test/hotspot/jtreg/compiler/hotcode/StressHotCodeCollector.java +++ b/test/hotspot/jtreg/compiler/hotcode/StressHotCodeCollector.java @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2026, 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 @@ -24,6 +25,7 @@ /* * @test + * @key randomness * @library /test/lib / * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox @@ -38,6 +40,7 @@ package compiler.hotcode; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Random; +import jdk.test.lib.Utils; import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.whitebox.WhiteBox; @@ -89,7 +92,7 @@ public class StressHotCodeCollector { generateCode(); long start = System.currentTimeMillis(); - Random random = new Random(); + Random random = Utils.getRandomInstance(); while (System.currentTimeMillis() - start < RUN_MILLIS) { for (TestMethod m : methods) { diff --git a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN_2.java b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN_2.java index b1170227542..417b0e02f31 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN_2.java +++ b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN_2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2025, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,6 +24,7 @@ /* * @test + * @key randomness * @bug 8365206 * @summary Verify NaN sign and significand bits are preserved across conversions, * float -> float16 -> float @@ -55,6 +56,7 @@ import compiler.whitebox.CompilerWhiteBoxTest; import jdk.test.whitebox.WhiteBox; import java.lang.reflect.Method; import java.util.Random; +import jdk.test.lib.Utils; public class Binary16ConversionNaN_2 { @@ -77,7 +79,7 @@ public class Binary16ConversionNaN_2 { float[] nVal = new float[1024]; float[] nRes = new float[1024]; - Random rand = new Random(); + Random rand = Utils.getRandomInstance(); // A NaN has a nonzero significand for (int i = 1; i <= 0x3ff; i++) { diff --git a/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java b/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java index 34f0411f4ed..69eac2a25a2 100644 --- a/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java +++ b/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2026, 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 @@ -23,8 +23,10 @@ /* * @test id=Xbatch + * @key randomness * @bug 8332920 * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". + * @library /test/lib * @run main/othervm/timeout=480 -Xbatch -XX:-TieredCompilation * -XX:CompileOnly=*TestPartialPeel*::original*,*TestPartialPeel*::test* * compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit @@ -32,8 +34,10 @@ /* * @test id=Xcomp-run-inline + * @key randomness * @bug 8332920 * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". + * @library /test/lib * @run main/othervm/timeout=480 -Xcomp -XX:-TieredCompilation * -XX:CompileOnly=*TestPartialPeel*::original*,*TestPartialPeel*::run*,*TestPartialPeel*::test* * -XX:CompileCommand=inline,*TestPartialPeelAtUnsignedTestsNegativeLimit::test* @@ -43,24 +47,29 @@ /* * @test id=Xcomp-compile-test + * @key randomness * @bug 8332920 * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". + * @library /test/lib * @run main/othervm/timeout=480 -Xcomp -XX:-TieredCompilation -XX:CompileOnly=*TestPartialPeel*::original*,*TestPartialPeel*::test* * compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit */ /* * @test id=vanilla + * @key randomness * @bug 8332920 * @requires vm.flavor == "server" & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 4) * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". * Only run this test with C2 since it is time-consuming and only tests a C2 issue. + * @library /test/lib * @run main/timeout=480 compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit */ package compiler.loopopts; import java.util.Random; +import jdk.test.lib.Utils; import static java.lang.Integer.*; @@ -69,7 +78,7 @@ public class TestPartialPeelAtUnsignedTestsNegativeLimit { static int iterations = 0; static int iFld2; static boolean flag; - final static Random RANDOM = new Random(); + final static Random RANDOM = Utils.getRandomInstance(); public static void main(String[] args) { compareUnsigned(3, 3); // Load Integer class for -Xcomp diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeCompilation.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeCompilation.java index cdd80d3baaa..e31c5f1015d 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeCompilation.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeCompilation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2026, 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 @@ -25,8 +25,10 @@ package compiler.loopopts.superword; /* * @test + * @key randomness * @bug 8327978 * @summary Test compile time for large compilation, where SuperWord takes especially much time. + * @library /test/lib * @run main/othervm/timeout=30 -Xbatch * -XX:CompileCommand=compileonly,compiler.loopopts.superword.TestLargeCompilation::test* * -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=1000 @@ -34,9 +36,10 @@ package compiler.loopopts.superword; */ import java.util.Random; +import jdk.test.lib.Utils; public class TestLargeCompilation { - private static final Random random = new Random(); + private static final Random random = Utils.getRandomInstance(); static final int RANGE_CON = 1024 * 8; static int init = 593436; diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestVectorMaskTrueCount.java b/test/hotspot/jtreg/compiler/vectorapi/TestVectorMaskTrueCount.java index aee68f1d4ee..202b92816b2 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/TestVectorMaskTrueCount.java +++ b/test/hotspot/jtreg/compiler/vectorapi/TestVectorMaskTrueCount.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2023, Arm Limited. All rights reserved. + * Copyright (c) 2026, 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 @@ -46,7 +47,7 @@ public class TestVectorMaskTrueCount { private static final VectorSpecies SPECIES_D = DoubleVector.SPECIES_128; private static final VectorSpecies SPECIES_I = IntVector.SPECIES_128; private static final int LENGTH = 1024; - private static final Random RD = new Random(); + private static final Random RD = Utils.getRandomInstance(); private static boolean[] ba; private static boolean[] bb; diff --git a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorDoubleRandom.java b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorDoubleRandom.java index cd1a59c6d24..78dd4f50a06 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorDoubleRandom.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorDoubleRandom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -37,6 +37,7 @@ package compiler.vectorization; import java.util.Random; +import jdk.test.lib.Utils; import static compiler.lib.golden.GoldenRound.golden_round; import compiler.lib.ir_framework.IR; import compiler.lib.ir_framework.IRNode; @@ -47,7 +48,7 @@ import compiler.lib.ir_framework.TestFramework; import compiler.lib.ir_framework.Warmup; public class TestRoundVectorDoubleRandom { - private static final Random rand = new Random(); + private static final Random rand = Utils.getRandomInstance(); private static final int ITERS = 11000; private static final int ARRLEN = rand.nextInt(4096-997) + 997; diff --git a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorFloatAll.java b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorFloatAll.java index a85ac3eaa22..6ed6182cb2b 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorFloatAll.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorFloatAll.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,6 +24,7 @@ /** * @test + * @key randomness * @bug 8321010 * @summary Test vector intrinsic for Math.round(float) in full 32 bits range * @@ -37,10 +38,11 @@ package compiler.vectorization; import java.util.Random; +import jdk.test.lib.Utils; import static compiler.lib.golden.GoldenRound.golden_round; public class TestRoundVectorFloatAll { - private static final Random rand = new Random(); + private static final Random rand = Utils.getRandomInstance(); private static final int ITERS = 11000; private static final int ARRLEN = rand.nextInt(4096-997) + 997; diff --git a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorFloatRandom.java b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorFloatRandom.java index 7288e4d9f63..474601346e8 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorFloatRandom.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectorFloatRandom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -37,6 +37,7 @@ package compiler.vectorization; import java.util.Random; +import jdk.test.lib.Utils; import static compiler.lib.golden.GoldenRound.golden_round; import compiler.lib.ir_framework.IR; import compiler.lib.ir_framework.IRNode; @@ -47,7 +48,7 @@ import compiler.lib.ir_framework.TestFramework; import compiler.lib.ir_framework.Warmup; public class TestRoundVectorFloatRandom { - private static final Random rand = new Random(); + private static final Random rand = Utils.getRandomInstance(); private static final int ITERS = 11000; private static final int ARRLEN = rand.nextInt(4096-997) + 997; diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/AllocationProfile.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/AllocationProfile.java index 8ad75e7d82d..fc29a6b9799 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/AllocationProfile.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/AllocationProfile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,6 +24,7 @@ */ import java.util.*; +import jdk.test.lib.Utils; public class AllocationProfile { @@ -47,7 +48,7 @@ public class AllocationProfile { * Returns random allocation size measured in words */ public long randomAllocationSize() { - Random r = new Random(); + Random r = Utils.getRandomInstance(); return r.nextInt((int)(maximumSingleAllocationSize - minimumSingleAllocationSize + 1)) + minimumSingleAllocationSize; } diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java index 7564bfafef8..3e41732ee17 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java @@ -26,6 +26,7 @@ /* * @test id=debug * @bug 8251158 + * @key randomness * @library /test/lib * @modules java.base/jdk.internal.misc java.management * @build jdk.test.whitebox.WhiteBox @@ -37,6 +38,7 @@ /* * @test id=ndebug * @bug 8251158 + * @key randomness * @library /test/lib * @modules java.base/jdk.internal.misc java.management * @build jdk.test.whitebox.WhiteBox diff --git a/test/hotspot/jtreg/runtime/NMT/NMTInitializationTest.java b/test/hotspot/jtreg/runtime/NMT/NMTInitializationTest.java index 8cbacfb5701..431af138a0c 100644 --- a/test/hotspot/jtreg/runtime/NMT/NMTInitializationTest.java +++ b/test/hotspot/jtreg/runtime/NMT/NMTInitializationTest.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2021 SAP SE. All rights reserved. - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, 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 @@ -45,6 +45,7 @@ /** * @test id=normal-off * @bug 8256844 + * @key randomness * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -54,6 +55,7 @@ /** * @test id=normal-detail * @bug 8256844 + * @key randomness * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -63,6 +65,7 @@ /** * @test id=default_long-off * @bug 8256844 + * @key randomness * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -72,6 +75,7 @@ /** * @test id=default_long-detail * @bug 8256844 + * @key randomness * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -87,6 +91,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Random; +import jdk.test.lib.Utils; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -95,7 +100,7 @@ public class NMTInitializationTest { final static boolean debug = true; static String randomString() { - Random r = new Random(); + Random r = Utils.getRandomInstance(); int len = r.nextInt(100) + 100; StringBuilder bld = new StringBuilder(); for (int i = 0; i < len; i ++) {