Example usage for org.apache.commons.math3.random Well44497a Well44497a

List of usage examples for org.apache.commons.math3.random Well44497a Well44497a

Introduction

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

Prototype

public Well44497a() 

Source Link

Document

Creates a new random number generator.

Usage

From source file:com.milaboratory.core.mutations.MutationsUtilTest.java

@Test
public void testRandomEncodeDecode() throws Exception {
    RandomGenerator rnd = new Well44497a();
    int n = 1000;
    for (Alphabet alphabet : Alphabets.getAll()) {
        for (int i = 0; i < n; ++i) {
            int[] r = createRandomMutations(alphabet, rnd.nextInt(100), rnd);
            Assert.assertArrayEquals(r, MutationsUtil.decode(MutationsUtil.encode(r, alphabet), alphabet));
        }/*from www  . ja v  a  2 s. c o m*/
    }
}

From source file:org.optaplanner.core.impl.solver.random.DefaultRandomFactory.java

@Override
public Random createRandom() {
    switch (randomType) {
    case JDK:/*from ww w  .jav  a 2  s.com*/
        return randomSeed == null ? new Random() : new Random(randomSeed);
    case MERSENNE_TWISTER:
        return new RandomAdaptor(randomSeed == null ? new MersenneTwister() : new MersenneTwister(randomSeed));
    case WELL512A:
        return new RandomAdaptor(randomSeed == null ? new Well512a() : new Well512a(randomSeed));
    case WELL1024A:
        return new RandomAdaptor(randomSeed == null ? new Well1024a() : new Well1024a(randomSeed));
    case WELL19937A:
        return new RandomAdaptor(randomSeed == null ? new Well19937a() : new Well19937a(randomSeed));
    case WELL19937C:
        return new RandomAdaptor(randomSeed == null ? new Well19937c() : new Well19937c(randomSeed));
    case WELL44497A:
        return new RandomAdaptor(randomSeed == null ? new Well44497a() : new Well44497a(randomSeed));
    case WELL44497B:
        return new RandomAdaptor(randomSeed == null ? new Well44497b() : new Well44497b(randomSeed));
    default:
        throw new IllegalStateException("The randomType (" + randomType + ") is not implemented.");
    }
}