Java Code Examples for java.util.SplittableRandom#split()

The following examples show how to use java.util.SplittableRandom#split() . 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 jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 2
Source File: SplittableRandomTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 3
Source File: SplittableRandomTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 4
Source File: SplittableRandomTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 5
Source File: SplittableRandomTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 6
Source File: SplittableRandomTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 7
Source File: SplittableRandomTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 8
Source File: SplittableRandomTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 10
Source File: SplittableRandomTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 12
Source File: SplittableRandomTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 13
Source File: SplittableRandomTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 15
Source File: SplittableRandomTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 16
Source File: SplittableRandomTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 17
Source File: SplittableRandomTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 18
Source File: SplittableRandomTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 19
Source File: MilvusClientExample.java    From milvus-sdk-java with Apache License 2.0 5 votes vote down vote up
static List<List<Float>> generateVectors(long vectorCount, long dimension) {
  SplittableRandom splitcollectionRandom = new SplittableRandom();
  List<List<Float>> vectors = new ArrayList<>();
  for (long i = 0; i < vectorCount; ++i) {
    splitcollectionRandom = splitcollectionRandom.split();
    DoubleStream doubleStream = splitcollectionRandom.doubles(dimension);
    List<Float> vector =
        doubleStream.boxed().map(Double::floatValue).collect(Collectors.toList());
    vectors.add(vector);
  }
  return vectors;
}
 
Example 20
Source File: SplittableRandomTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}