本文整理汇总了Java中java.util.SplittableRandom.split方法的典型用法代码示例。如果您正苦于以下问题:Java SplittableRandom.split方法的具体用法?Java SplittableRandom.split怎么用?Java SplittableRandom.split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.SplittableRandom
的用法示例。
在下文中一共展示了SplittableRandom.split方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSplit1
import java.util.SplittableRandom; //导入方法依赖的package包/类
/**
* 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);
}
}
示例2: testSplit2
import java.util.SplittableRandom; //导入方法依赖的package包/类
/**
* 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);
}
}