Package org.uncommons.maths.random

Examples of org.uncommons.maths.random.MersenneTwisterRNG.nextInt()


    Random rng = new MersenneTwisterRNG();
    int tp, tn, fp, fn;
    double se, sp;

    for (int nloop = 0; nloop < n; nloop++) {
      tp = rng.nextInt(1000);
      tn = rng.nextInt(1000);
      fp = rng.nextInt(1000);
      fn = rng.nextInt(1000);

      CDFitness fitness = new CDFitness(tp, fp, tn, fn);
View Full Code Here


    int tp, tn, fp, fn;
    double se, sp;

    for (int nloop = 0; nloop < n; nloop++) {
      tp = rng.nextInt(1000);
      tn = rng.nextInt(1000);
      fp = rng.nextInt(1000);
      fn = rng.nextInt(1000);

      CDFitness fitness = new CDFitness(tp, fp, tn, fn);
      se = ((double) tp) / (tp + fn);
View Full Code Here

    double se, sp;

    for (int nloop = 0; nloop < n; nloop++) {
      tp = rng.nextInt(1000);
      tn = rng.nextInt(1000);
      fp = rng.nextInt(1000);
      fn = rng.nextInt(1000);

      CDFitness fitness = new CDFitness(tp, fp, tn, fn);
      se = ((double) tp) / (tp + fn);
      sp = ((double) tn) / (tn + fp);
View Full Code Here

    for (int nloop = 0; nloop < n; nloop++) {
      tp = rng.nextInt(1000);
      tn = rng.nextInt(1000);
      fp = rng.nextInt(1000);
      fn = rng.nextInt(1000);

      CDFitness fitness = new CDFitness(tp, fp, tn, fn);
      se = ((double) tp) / (tp + fn);
      sp = ((double) tn) / (tn + fp);
View Full Code Here

      // all weights are 1 (active)
      CDRule rule = new CDRule(0.);
      for (int condInd = 0; condInd < rule.getNbConditions(); condInd++) {
        rule.setW(condInd, 1.);
        rule.setO(condInd, rng.nextBoolean());
        rule.setV(condInd, rng.nextInt(2)); // two categories
      }

      // the condition is true if the operator is == and the values are equal
      // (value==1), or the operator is != and the values are no equal
      // (value==0)
View Full Code Here

    DataSet.initialize(dataset);

    for (int nloop = 0; nloop < n; nloop++) {
      // we need at least 2 attributes for the crossover
      // and a label that will be skipped by the rules
      int nbattributes = rng.nextInt(maxattributes) + 3;
      int crosspnts = rng.nextInt(maxcrosspnts) + 1;

      // prepare dataset mock
      EasyMock.reset(dataset);
      EasyMock.expect(dataset.getNbAttributes()).andReturn(nbattributes).times(2);
View Full Code Here

    for (int nloop = 0; nloop < n; nloop++) {
      // we need at least 2 attributes for the crossover
      // and a label that will be skipped by the rules
      int nbattributes = rng.nextInt(maxattributes) + 3;
      int crosspnts = rng.nextInt(maxcrosspnts) + 1;

      // prepare dataset mock
      EasyMock.reset(dataset);
      EasyMock.expect(dataset.getNbAttributes()).andReturn(nbattributes).times(2);
      EasyMock.replay(dataset);
View Full Code Here

    // Initialize dataset
    DataSet dataset = EasyMock.createMock(DataSet.class);
    DataSet.initialize(dataset);

    for (int nloop = 0; nloop < n; nloop++) {
      int nbattributes = rng.nextInt(maxattributes) + 3;
      int crosspnts = rng.nextInt(maxcrosspnts) + 1;
      // in the case of this test crosspnts should be < nbattributes
      if (crosspnts >= nbattributes)
        crosspnts = nbattributes - 1;
View Full Code Here

    DataSet dataset = EasyMock.createMock(DataSet.class);
    DataSet.initialize(dataset);

    for (int nloop = 0; nloop < n; nloop++) {
      int nbattributes = rng.nextInt(maxattributes) + 3;
      int crosspnts = rng.nextInt(maxcrosspnts) + 1;
      // in the case of this test crosspnts should be < nbattributes
      if (crosspnts >= nbattributes)
        crosspnts = nbattributes - 1;

      // prepare dataset mock
View Full Code Here

    List<Double> evaluations = randomFloats(size, rng);
    mock.shouldReturn(evaluations);

    // call with population A
    mock.getFitness(population.get(rng.nextInt(size)), population);

    // generate a new population B
    population = randomInts(size, rng);

    // call with population B
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.