Java Code Examples for java.util.SplittableRandom#nextLong()
The following examples show how to use
java.util.SplittableRandom#nextLong() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SplittableRandomTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * nextLong(least, bound) returns least <= value < bound; * repeated calls produce at least two distinct results */ public void testNextLongBounded2() { SplittableRandom sr = new SplittableRandom(); for (long least = -86028121; least < MAX_LONG_BOUND; least += 982451653L) { for (long bound = least + 2; bound > least && bound < MAX_LONG_BOUND; bound += Math.abs(bound * 7919)) { long f = sr.nextLong(least, bound); assertTrue(least <= f && f < bound); int i = 0; long j; while (i < NCALLS && (j = sr.nextLong(least, bound)) == f) { assertTrue(least <= j && j < bound); ++i; } assertTrue(i < NCALLS); } } }
Example 2
Source File: SplittableRandomTest.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * nextLong(bound) returns 0 <= value < bound; * repeated calls produce at least two distinct results */ public void testNextLongBounded() { SplittableRandom sr = new SplittableRandom(); for (long bound = 2; bound < MAX_LONG_BOUND; bound += 15485863) { long f = sr.nextLong(bound); assertTrue(0 <= f && f < bound); int i = 0; long j; while (i < NCALLS && (j = sr.nextLong(bound)) == f) { assertTrue(0 <= j && j < bound); ++i; } assertTrue(i < NCALLS); } }
Example 3
Source File: SplittableRandomTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * nextLong(bound) returns 0 <= value < bound; * repeated calls produce at least two distinct results */ public void testNextLongBounded() { SplittableRandom sr = new SplittableRandom(); for (long bound = 2; bound < MAX_LONG_BOUND; bound += 15485863) { long f = sr.nextLong(bound); assertTrue(0 <= f && f < bound); int i = 0; long j; while (i < NCALLS && (j = sr.nextLong(bound)) == f) { assertTrue(0 <= j && j < bound); ++i; } assertTrue(i < NCALLS); } }
Example 4
Source File: SplittableRandomTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * nextLong(bound) returns 0 <= value < bound; * repeated calls produce at least two distinct results */ public void testNextLongBounded() { SplittableRandom sr = new SplittableRandom(); for (long bound = 2; bound < MAX_LONG_BOUND; bound += 15485863) { long f = sr.nextLong(bound); assertTrue(0 <= f && f < bound); int i = 0; long j; while (i < NCALLS && (j = sr.nextLong(bound)) == f) { assertTrue(0 <= j && j < bound); ++i; } assertTrue(i < NCALLS); } }
Example 5
Source File: SplittableRandomTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * A SplittableRandom produced by split() of a default-constructed * SplittableRandom generates a different sequence */ public void testSplit1() { SplittableRandom sr = new SplittableRandom(); for (int reps = 0; reps < REPS; ++reps) { SplittableRandom sc = sr.split(); int i = 0; while (i < NCALLS && sr.nextLong() == sc.nextLong()) ++i; assertTrue(i < NCALLS); } }
Example 6
Source File: SplittableRandomTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * A SplittableRandom produced by split() of a seeded-constructed * SplittableRandom generates a different sequence */ public void testSplit2() { SplittableRandom sr = new SplittableRandom(12345); for (int reps = 0; reps < REPS; ++reps) { SplittableRandom sc = sr.split(); int i = 0; while (i < NCALLS && sr.nextLong() == sc.nextLong()) ++i; assertTrue(i < NCALLS); } }
Example 7
Source File: SplittableRandomTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Repeated calls to nextLong produce at least two distinct results */ public void testNextLong() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(); int i = 0; while (i < NCALLS && sr.nextLong() == f) ++i; assertTrue(i < NCALLS); }
Example 8
Source File: SplittableRandomTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * A SplittableRandom produced by split() of a default-constructed * SplittableRandom generates a different sequence */ public void testSplit1() { SplittableRandom sr = new SplittableRandom(); for (int reps = 0; reps < REPS; ++reps) { SplittableRandom sc = sr.split(); int i = 0; while (i < NCALLS && sr.nextLong() == sc.nextLong()) ++i; assertTrue(i < NCALLS); } }
Example 9
Source File: SplittableRandomTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Repeated calls to nextLong produce at least two distinct results */ public void testNextLong() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(); int i = 0; while (i < NCALLS && sr.nextLong() == f) ++i; assertTrue(i < NCALLS); }
Example 10
Source File: SplittableRandomTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * A SplittableRandom produced by split() of a default-constructed * SplittableRandom generates a different sequence */ public void testSplit1() { SplittableRandom sr = new SplittableRandom(); for (int reps = 0; reps < REPS; ++reps) { SplittableRandom sc = sr.split(); int i = 0; while (i < NCALLS && sr.nextLong() == sc.nextLong()) ++i; assertTrue(i < NCALLS); } }
Example 11
Source File: SplittableRandomTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Repeated calls to nextLong produce at least two distinct results */ public void testNextLong() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(); int i = 0; while (i < NCALLS && sr.nextLong() == f) ++i; assertTrue(i < NCALLS); }
Example 12
Source File: SplittableRandomTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * A SplittableRandom produced by split() of a seeded-constructed * SplittableRandom generates a different sequence */ public void testSplit2() { SplittableRandom sr = new SplittableRandom(12345); for (int reps = 0; reps < REPS; ++reps) { SplittableRandom sc = sr.split(); int i = 0; while (i < NCALLS && sr.nextLong() == sc.nextLong()) ++i; assertTrue(i < NCALLS); } }
Example 13
Source File: SplittableRandomTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * A SplittableRandom produced by split() of a seeded-constructed * SplittableRandom generates a different sequence */ public void testSplit2() { SplittableRandom sr = new SplittableRandom(12345); for (int reps = 0; reps < REPS; ++reps) { SplittableRandom sc = sr.split(); int i = 0; while (i < NCALLS && sr.nextLong() == sc.nextLong()) ++i; assertTrue(i < NCALLS); } }
Example 14
Source File: SplittableRandomTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Repeated calls to nextLong produce at least two distinct results */ public void testNextLong() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(); int i = 0; while (i < NCALLS && sr.nextLong() == f) ++i; assertTrue(i < NCALLS); }
Example 15
Source File: SplittableRandomTest.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * nextLong(negative) throws IllegalArgumentException */ @Test(expectedExceptions = IllegalArgumentException.class) public void testNextLongBoundedNeg() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(-17); }
Example 16
Source File: SplittableRandomTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * nextLong(least >= bound) throws IllegalArgumentException */ @Test(expectedExceptions = IllegalArgumentException.class) public void testNextLongBadBounds() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(17, 2); }
Example 17
Source File: SplittableRandomTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * nextLong(least >= bound) throws IllegalArgumentException */ @Test(expectedExceptions = IllegalArgumentException.class) public void testNextLongBadBounds() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(17, 2); }
Example 18
Source File: SplittableRandomTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * nextLong(least >= bound) throws IllegalArgumentException */ @Test(expectedExceptions = IllegalArgumentException.class) public void testNextLongBadBounds() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(17, 2); }
Example 19
Source File: SplittableRandomTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * nextLong(least >= bound) throws IllegalArgumentException */ @Test(expectedExceptions = IllegalArgumentException.class) public void testNextLongBadBounds() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(17, 2); }
Example 20
Source File: SplittableRandomTest.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * nextLong(negative) throws IllegalArgumentException */ @Test(expectedExceptions = IllegalArgumentException.class) public void testNextLongBoundedNeg() { SplittableRandom sr = new SplittableRandom(); long f = sr.nextLong(-17); }