Example usage for org.apache.commons.math3.random Well19937a nextLong

List of usage examples for org.apache.commons.math3.random Well19937a nextLong

Introduction

In this page you can find the example usage for org.apache.commons.math3.random Well19937a nextLong.

Prototype

public long nextLong() 

Source Link

Usage

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);
    }/*www.  j  a  v  a2  s  . c om*/
}

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  ww  w. ja  va 2  s  .  com*/
        }

        assertDiffSizeClusters(strategy.getDummy(), clusters);
        assertClusters(false, strategy, clusters);
    }
}