< prev index next >

test/java/util/SplittableRandom/SplittableRandomTest.java

Print this page




  22  */
  23 
  24 import org.testng.Assert;
  25 import org.testng.annotations.Test;
  26 
  27 import java.util.SplittableRandom;
  28 import java.util.concurrent.ThreadLocalRandom;
  29 import java.util.concurrent.atomic.AtomicInteger;
  30 import java.util.concurrent.atomic.LongAdder;
  31 import java.util.function.BiConsumer;
  32 
  33 import static org.testng.Assert.assertEquals;
  34 import static org.testng.Assert.assertNotNull;
  35 import static org.testng.AssertJUnit.assertTrue;
  36 
  37 /**
  38  * @test
  39  * @run testng SplittableRandomTest
  40  * @run testng/othervm -Djava.util.secureRandomSeed=true SplittableRandomTest
  41  * @summary test methods on SplittableRandom

  42  */
  43 @Test
  44 public class SplittableRandomTest {
  45 
  46     // Note: this test was copied from the 166 TCK SplittableRandomTest test
  47     // and modified to be a TestNG test
  48 
  49     /*
  50      * Testing coverage notes:
  51      *
  52      * 1. Many of the test methods are adapted from ThreadLocalRandomTest.
  53      *
  54      * 2. These tests do not check for random number generator quality.
  55      * But we check for minimal API compliance by requiring that
  56      * repeated calls to nextX methods, up to NCALLS tries, produce at
  57      * least two distinct results. (In some possible universe, a
  58      * "correct" implementation might fail, but the odds are vastly
  59      * less than that of encountering a hardware failure while running
  60      * the test.) For bounded nextX methods, we sample various
  61      * intervals across multiples of primes. In other tests, we repeat




  22  */
  23 
  24 import org.testng.Assert;
  25 import org.testng.annotations.Test;
  26 
  27 import java.util.SplittableRandom;
  28 import java.util.concurrent.ThreadLocalRandom;
  29 import java.util.concurrent.atomic.AtomicInteger;
  30 import java.util.concurrent.atomic.LongAdder;
  31 import java.util.function.BiConsumer;
  32 
  33 import static org.testng.Assert.assertEquals;
  34 import static org.testng.Assert.assertNotNull;
  35 import static org.testng.AssertJUnit.assertTrue;
  36 
  37 /**
  38  * @test
  39  * @run testng SplittableRandomTest
  40  * @run testng/othervm -Djava.util.secureRandomSeed=true SplittableRandomTest
  41  * @summary test methods on SplittableRandom
  42  * @key randomness
  43  */
  44 @Test
  45 public class SplittableRandomTest {
  46 
  47     // Note: this test was copied from the 166 TCK SplittableRandomTest test
  48     // and modified to be a TestNG test
  49 
  50     /*
  51      * Testing coverage notes:
  52      *
  53      * 1. Many of the test methods are adapted from ThreadLocalRandomTest.
  54      *
  55      * 2. These tests do not check for random number generator quality.
  56      * But we check for minimal API compliance by requiring that
  57      * repeated calls to nextX methods, up to NCALLS tries, produce at
  58      * least two distinct results. (In some possible universe, a
  59      * "correct" implementation might fail, but the odds are vastly
  60      * less than that of encountering a hardware failure while running
  61      * the test.) For bounded nextX methods, we sample various
  62      * intervals across multiples of primes. In other tests, we repeat


< prev index next >