Package org.apache.commons.math.random

Examples of org.apache.commons.math.random.RandomDataImpl.nextInt()


        ResizableDoubleArray eDA2 = new ResizableDoubleArray(2);
        assertEquals("Initial number of elements should be 0", 0, eDA2.getNumElements());

        RandomData randomData = new RandomDataImpl();
        int iterations = randomData.nextInt(100, 1000);

        for( int i = 0; i < iterations; i++) {
            eDA2.addElement( i );
        }
View Full Code Here


        ResizableDoubleArray eDA3 = new ResizableDoubleArray(3, 3.0f, 3.5f);
        assertEquals("Initial number of elements should be 0", 0, eDA3.getNumElements() );

        RandomData randomData = new RandomDataImpl();
        int iterations = randomData.nextInt(100, 3000);

        for( int i = 0; i < iterations; i++) {
            eDA3.addElement( i );
        }
View Full Code Here

      }
    }
    state.getMap().remove(LAST_SETTING);
    state.getMap().remove(LAST_TABLE_SETTING);
    RandomData random = new RandomDataImpl();
    if (random.nextInt(0, 1) == 0) {
      changeTableSetting(random, state, props);
    } else {
      changeSetting(random, state, props);
    }
  }
View Full Code Here

        RandomData randomData = new RandomDataImpl();

        // Fill weights array with random int values between 1 and 5
        int[] intWeights = new int[len];
        for (int i = 0; i < len; i++) {
            intWeights[i] = randomData.nextInt(1, 5);
            weights[i] = intWeights[i];
        }

        // Fill values array with random data from N(mu, sigma)
        // and fill valuesList with values from values array with
View Full Code Here

      }
    }
    state.getMap().remove(LAST_SETTING);
    state.getMap().remove(LAST_TABLE_SETTING);
    RandomData random = new RandomDataImpl();
    if (random.nextInt(0, 1) == 0) {
      changeTableSetting(random, state, props);
    } else {
      changeSetting(random, state, props);
    }
  }
View Full Code Here

  public static Number pickRange(NumberRange range) {
    Number result = null;
    RandomData randomData = new RandomDataImpl();

    if (range.getMinimumNumber() instanceof Integer && range.getMaximumNumber() instanceof Integer) {
      result = randomData.nextInt(range.getMinimumInteger(), range.getMaximumInteger());
    }

    if (range.getMinimumNumber() instanceof Long && range.getMaximumNumber() instanceof Long) {
      result = randomData.nextLong(range.getMinimumLong(), range.getMaximumLong());
    }
View Full Code Here

       
        ResizableDoubleArray eDA2 = new ResizableDoubleArray(2);
        assertEquals("Initial number of elements should be 0", 0, eDA2.getNumElements());
       
        RandomData randomData = new RandomDataImpl();
        int iterations = randomData.nextInt(100, 1000);
       
        for( int i = 0; i < iterations; i++) {
            eDA2.addElement( i );
        }
       
View Full Code Here

       
        ResizableDoubleArray eDA3 = new ResizableDoubleArray(3, 3.0f, 3.5f);
        assertEquals("Initial number of elements should be 0", 0, eDA3.getNumElements() );
       
        RandomData randomData = new RandomDataImpl();
        int iterations = randomData.nextInt(100, 3000);
       
        for( int i = 0; i < iterations; i++) {
            eDA3.addElement( i );
        }
       
View Full Code Here

        ResizableDoubleArray eDA3 = new ResizableDoubleArray(3, 3.0f, 3.5f);
        assertEquals("Initial number of elements should be 0", 0, eDA3.getNumElements() );

        RandomData randomData = new RandomDataImpl();
        int iterations = randomData.nextInt(100, 3000);

        for( int i = 0; i < iterations; i++) {
            eDA3.addElement( i );
        }
View Full Code Here

     *
     * @return array of random double values
     */
    private double[] generateSample() {
        final RandomData randomData = new RandomDataImpl();
        final int sampleSize = randomData.nextInt(10,100);
        double[] out = new double[sampleSize];
        for (int i = 0; i < out.length; i++) {
            out[i] = randomData.nextUniform(-100, 100);
        }
        return out;
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.