List of usage examples for org.apache.commons.math3.random Well19937a nextInt
public int nextInt(int n) throws IllegalArgumentException
This default implementation is copied from Apache Harmony java.util.Random (r929253).
Implementation notes:
From source file:com.milaboratory.core.clustering.ClusteringTest.java
@Test public void testRandom1() throws Exception { int out = TestUtil.its(3, 30); Well19937a rand = new Well19937a(); for (int x = 0; x < out; ++x) { int N = TestUtil.its(40, 300); Cluster<TestObject>[] clusters = new Cluster[N]; Well19937a rand1 = new Well19937a(rand.nextLong()); TestStrategy strategy = new TestStrategy(5, new TreeSearchParameters(1, 1, 1, 1)); for (int i = 0; i < N; ++i) clusters[i] = getRandomTestCluster( TestUtil.randomSequence(NucleotideSequence.ALPHABET, rand1, 45, 55), strategy.depth, 5, 10000 + rand1.nextInt(10000), 5 + rand1.nextInt(900), rand1.nextLong()); assertClusters(false, strategy, clusters); }/*from w w w .jav a 2 s . c o m*/ }
From source file:com.milaboratory.core.clustering.ClusteringTest.java
@Test public void testRandom2WithColor() { int out = TestUtil.its(3, 30); Well19937a rand = new Well19937a(); int colors = 3; for (int x = 0; x < out; ++x) { int N = TestUtil.its(16, 100); Cluster<TestObject>[] clusters = new Cluster[N * colors]; Well19937a rand1 = new Well19937a(rand.nextLong()); TestStrategy strategy = new TestStrategy(5, new TreeSearchParameters(1, 1, 1, 1)); int c = 0; for (int i = 0; i < N; ++i) { long seed = rand1.nextLong(); NucleotideSequence sequence = TestUtil.randomSequence(NucleotideSequence.ALPHABET, rand1, 45, 55); for (int color = 0; color < colors; ++color) { clusters[c++] = getRandomTestCluster(sequence, color, strategy.depth, 5, 10000 + rand1.nextInt(10000), 5 + rand1.nextInt(900), seed); }//from w w w. jav a 2 s .c o m } assertDiffSizeClusters(strategy.getDummy(), clusters); assertClusters(false, strategy, clusters); } }