Examples of RandomDataImpl


Examples of org.apache.commons.math.random.RandomDataImpl

    public void testWithInitialCapacity() {
       
        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

Examples of org.apache.commons.math.random.RandomDataImpl

        double[] test1 = {5,4,3,2,1};
        double[] test2 = {5,2,1,3,4,0};
        double[] test3 = {1};
        int[] testi = null;
        double[] test4 = null;
        RandomData rd = new RandomDataImpl();
        tstGetSortedValues(test1);
        tstGetSortedValues(test2);
        tstGetSortedValues(test3);
        for (int i = 0; i < 10; i++) {
            testi = rd.nextPermutation(10,6);
            test4 = new double[6];
            for (int j = 0; j < testi.length; j++) {
                test4[j] = (double) testi[j];
            }
            tstGetSortedValues(test4);
        }
        for (int i = 0; i < 10; i++) {
            testi = rd.nextPermutation(10,5);
            test4 = new double[5];
            for (int j = 0; j < testi.length; j++) {
                test4[j] = (double) testi[j];
            }
            tstGetSortedValues(test4);
View Full Code Here

Examples of org.apache.commons.math.random.RandomDataImpl

        assertEquals("Q1",1,u.getPercentile(25),10E-12);
        assertEquals("Q3",1,u.getPercentile(75),10E-12);
        assertEquals("Q2",1,u.getPercentile(50),10E-12);
       
        u.clear();
        RandomData rd = new RandomDataImpl();
        int[] testi = rd.nextPermutation(100,100); // will contain 0-99
        for (int j = 0; j < testi.length; j++) {
            u.addValue((double) testi[j])//OK, laugh at me for the cast
        }
        for (int i = 1; i < 100; i++) {
            assertEquals("percentile " + i,
View Full Code Here

Examples of org.apache.commons.math.random.RandomDataImpl

        double[] test1 = {5,4,3,2,1};
        double[] test2 = {5,2,1,3,4,0};
        double[] test3 = {1};
        int[] testi = null;
        double[] test4 = null;
        RandomData rd = new RandomDataImpl();
        tstGetSortedValues(test1);
        tstGetSortedValues(test2);
        tstGetSortedValues(test3);
        for (int i = 0; i < 10; i++) {
            testi = rd.nextPermutation(10,6);
            test4 = new double[6];
            for (int j = 0; j < testi.length; j++) {
                test4[j] = (double) testi[j];
            }
            tstGetSortedValues(test4);
        }
        for (int i = 0; i < 10; i++) {
            testi = rd.nextPermutation(10,5);
            test4 = new double[5];
            for (int j = 0; j < testi.length; j++) {
                test4[j] = (double) testi[j];
            }
            tstGetSortedValues(test4);
View Full Code Here

Examples of org.apache.commons.math3.random.RandomDataImpl

     */
    public NaturalRanking(TiesStrategy tiesStrategy) {
        super();
        this.tiesStrategy = tiesStrategy;
        nanStrategy = DEFAULT_NAN_STRATEGY;
        randomData = new RandomDataImpl();
    }
View Full Code Here

Examples of org.apache.commons.math3.random.RandomDataImpl

     */
    public NaturalRanking(NaNStrategy nanStrategy, TiesStrategy tiesStrategy) {
        super();
        this.nanStrategy = nanStrategy;
        this.tiesStrategy = tiesStrategy;
        randomData = new RandomDataImpl();
    }
View Full Code Here

Examples of org.apache.commons.math3.random.RandomDataImpl

     */
    public NaturalRanking(RandomGenerator randomGenerator) {
        super();
        this.tiesStrategy = TiesStrategy.RANDOM;
        nanStrategy = DEFAULT_NAN_STRATEGY;
        randomData = new RandomDataImpl(randomGenerator);
    }
View Full Code Here

Examples of org.apache.commons.math3.random.RandomDataImpl

    public NaturalRanking(NaNStrategy nanStrategy,
            RandomGenerator randomGenerator) {
        super();
        this.nanStrategy = nanStrategy;
        this.tiesStrategy = TiesStrategy.RANDOM;
        randomData = new RandomDataImpl(randomGenerator);
    }
View Full Code Here

Examples of org.apache.commons.math3.random.RandomDataImpl

     */
    @Test
    public void testPermutedArrayHash() {
        double[] original = new double[10];
        double[] permuted = new double[10];
        RandomDataImpl random = new RandomDataImpl();

        // Generate 10 distinct random values
        for (int i = 0; i < 10; i++) {
            final RealDistribution u = new UniformRealDistribution(i + 0.5, i + 0.75);
            original[i] = u.sample();
        }

        // Generate a random permutation, making sure it is not the identity
        boolean isIdentity = true;
        do {
            int[] permutation = random.nextPermutation(10, 10);
            for (int i = 0; i < 10; i++) {
                if (i != permutation[i]) {
                    isIdentity = false;
                }
                permuted[i] = original[permutation[i]];
View Full Code Here

Examples of org.apache.commons.math3.random.RandomDataImpl

     */
    @Test
    public void testPermutedArrayHash() {
        double[] original = new double[10];
        double[] permuted = new double[10];
        RandomDataImpl random = new RandomDataImpl();

        // Generate 10 distinct random values
        for (int i = 0; i < 10; i++) {
            final RealDistribution u = new UniformRealDistribution(i + 0.5, i + 0.75);
            original[i] = u.sample();
        }

        // Generate a random permutation, making sure it is not the identity
        boolean isIdentity = true;
        do {
            int[] permutation = random.nextPermutation(10, 10);
            for (int i = 0; i < 10; i++) {
                if (i != permutation[i]) {
                    isIdentity = false;
                }
                permuted[i] = original[permutation[i]];
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.