18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import org.testng.Assert;
25 import org.testng.annotations.Test;
26
27 import java.util.Random;
28 import java.util.concurrent.atomic.AtomicInteger;
29 import java.util.concurrent.atomic.LongAdder;
30 import java.util.function.BiConsumer;
31
32 import static org.testng.Assert.*;
33
34 /**
35 * @test
36 * @run testng RandomTest
37 * @summary test methods on Random
38 */
39 @Test
40 public class RandomTest {
41
42 // Note: this test was adapted from the 166 TCK ThreadLocalRandomTest test
43 // and modified to be a TestNG test
44
45 /*
46 * Testing coverage notes:
47 *
48 * We don't test randomness properties, but only that repeated
49 * calls, up to NCALLS tries, produce at least one different
50 * result. For bounded versions, we sample various intervals
51 * across multiples of primes.
52 */
53
54 // max numbers of calls to detect getting stuck on one value
55 static final int NCALLS = 10000;
56
57 // max sampled int bound
|
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import org.testng.Assert;
25 import org.testng.annotations.Test;
26
27 import java.util.Random;
28 import java.util.concurrent.atomic.AtomicInteger;
29 import java.util.concurrent.atomic.LongAdder;
30 import java.util.function.BiConsumer;
31
32 import static org.testng.Assert.*;
33
34 /**
35 * @test
36 * @run testng RandomTest
37 * @summary test methods on Random
38 * @key randomness
39 */
40 @Test
41 public class RandomTest {
42
43 // Note: this test was adapted from the 166 TCK ThreadLocalRandomTest test
44 // and modified to be a TestNG test
45
46 /*
47 * Testing coverage notes:
48 *
49 * We don't test randomness properties, but only that repeated
50 * calls, up to NCALLS tries, produce at least one different
51 * result. For bounded versions, we sample various intervals
52 * across multiples of primes.
53 */
54
55 // max numbers of calls to detect getting stuck on one value
56 static final int NCALLS = 10000;
57
58 // max sampled int bound
|