org.apache.commons.math3.exception.NotStrictlyPositiveException Java Examples

The following examples show how to use org.apache.commons.math3.exception.NotStrictlyPositiveException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Cardumen_0060_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #2
Source File: Cardumen_00127_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #3
Source File: Math_6_PowellOptimizer_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * This constructor allows to specify a user-defined convergence checker,
 * in addition to the parameters that control the default convergence
 * checking procedure and the line search tolerances.
 *
 * @param rel Relative threshold for this optimizer.
 * @param abs Absolute threshold for this optimizer.
 * @param lineRel Relative threshold for the internal line search optimizer.
 * @param lineAbs Absolute threshold for the internal line search optimizer.
 * @param checker Convergence checker.
 * @throws NotStrictlyPositiveException if {@code abs <= 0}.
 * @throws NumberIsTooSmallException if {@code rel < 2 * Math.ulp(1d)}.
 */
public PowellOptimizer(double rel,
                       double abs,
                       double lineRel,
                       double lineAbs,
                       ConvergenceChecker<PointValuePair> checker) {
    super(checker);

    if (rel < MIN_RELATIVE_TOLERANCE) {
        throw new NumberIsTooSmallException(rel, MIN_RELATIVE_TOLERANCE, true);
    }
    if (abs <= 0) {
        throw new NotStrictlyPositiveException(abs);
    }
    relativeThreshold = rel;
    absoluteThreshold = abs;

    // Create the line search optimizer.
    line = new LineSearch(lineRel,
                          lineAbs);
}
 
Example #4
Source File: Math_12_BitsStreamGenerator_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 * <p>This default implementation is copied from Apache Harmony
 * java.util.Random (r929253).</p>
 *
 * <p>Implementation notes: <ul>
 * <li>If n is a power of 2, this method returns
 * {@code (int) ((n * (long) next(31)) >> 31)}.</li>
 *
 * <li>If n is not a power of 2, what is returned is {@code next(31) % n}
 * with {@code next(31)} values rejected (i.e. regenerated) until a
 * value that is larger than the remainder of {@code Integer.MAX_VALUE / n}
 * is generated. Rejection of this initial segment is necessary to ensure
 * a uniform distribution.</li></ul></p>
 */
public int nextInt(int n) throws IllegalArgumentException {
    if (n > 0) {
        if ((n & -n) == n) {
            return (int) ((n * (long) next(31)) >> 31);
        }
        int bits;
        int val;
        do {
            bits = next(31);
            val = bits % n;
        } while (bits - val + (n - 1) < 0);
        return val;
    }
    throw new NotStrictlyPositiveException(n);
}
 
Example #5
Source File: Cardumen_00127_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

   for (int i = 0; sampleSize <= 0; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #6
Source File: Arja_00158_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #7
Source File: Math_22_FDistribution_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if
 * {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example #8
Source File: Arja_00158_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
    	++i;
    }

    return out;

}
 
Example #9
Source File: Cardumen_00179_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #10
Source File: Arja_00144_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #11
Source File: Cardumen_00272_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; sampleSize > 1; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #12
Source File: 1_DiscreteDistribution.java    From SimFix with GNU General Public License v2.0 6 votes vote down vote up
/**
     * Generate a random sample from the distribution.
     *
     * @param sampleSize the number of random values to generate.
     * @return an array representing the random sample.
     * @throws NotStrictlyPositiveException if {@code sampleSize} is not
     * positive.
     */
    public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
        if (sampleSize <= 0) {
            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                    sampleSize);
        }

        final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

// start of generated patch
for(int i=2;i<sampleSize;i++){
out[i]=sample();
}
// end of generated patch
/* start of original code
        for (int i = 0; i < sampleSize; i++) {
            out[i] = sample();
        }
 end of original code*/

        return out;

    }
 
Example #13
Source File: Arja_0085_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #14
Source File: Arja_00127_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #15
Source File: Arja_00127_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    if (sampleSize < 0) {
    	  throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,sampleSize);
    }

    return out;

}
 
Example #16
Source File: Math_8_DiscreteDistribution_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public Object[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final Object[] out = new Object[sampleSize];

    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #17
Source File: Arja_0085_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
    	continue;
    }

    return out;

}
 
Example #18
Source File: Arja_00108_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    if (sampleSize <= 0) {
    	  throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,sampleSize);
    }

    return out;

}
 
Example #19
Source File: Cardumen_00229_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }

    return out;

}
 
Example #20
Source File: Nopol2017_0064_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Samples the specified univariate real function on the specified interval.
 * <br/>
 * The interval is divided equally into {@code n} sections and sample points
 * are taken from {@code min} to {@code max - (max - min) / n}; therefore
 * {@code f} is not sampled at the upper bound {@code max}.
 *
 * @param f Function to be sampled
 * @param min Lower bound of the interval (included).
 * @param max Upper bound of the interval (excluded).
 * @param n Number of sample points.
 * @return the array of samples.
 * @throws NumberIsTooLargeException if the lower bound {@code min} is
 * greater than, or equal to the upper bound {@code max}.
 * @throws NotStrictlyPositiveException if the number of sample points
 * {@code n} is negative.
 */
public static double[] sample(UnivariateFunction f,
                              double min, double max, int n) {

    if (n <= 0) {
        throw new NotStrictlyPositiveException(
                LocalizedFormats.NOT_POSITIVE_NUMBER_OF_SAMPLES,
                Integer.valueOf(n));
    }
    if (min >= max) {
        throw new NumberIsTooLargeException(min, max, false);
    }

    final double[] s = new double[n];
    final double h = (max - min) / n;
    for (int i = 0; i < n; i++) {
        s[i] = f.value(min + i * h);
    }
    return s;
}
 
Example #21
Source File: Nopol2017_0063_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation generates the sample by calling
 * {@link #sample()} in a loop.
 */
public int[] sample(int sampleSize) {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(
                LocalizedFormats.NUMBER_OF_SAMPLES, sampleSize);
    }
    int[] out = new int[sampleSize];
    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }
    return out;
}
 
Example #22
Source File: Cardumen_0039_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Create a normal distribution using the given mean, standard deviation and
 * inverse cumulative distribution accuracy.
 *
 * @param mean Mean for this distribution.
 * @param sd Standard deviation for this distribution.
 * @param inverseCumAccuracy Inverse cumulative probability accuracy.
 * @throws NotStrictlyPositiveException if {@code sd <= 0}.
 * @since 2.1
 */
public NormalDistribution(double mean, double sd, double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    if (sd <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.STANDARD_DEVIATION, sd);
    }

    this.mean = mean;
    standardDeviation = sd;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example #23
Source File: Cardumen_00106_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation generates the sample by calling
 * {@link #sample()} in a loop.
 */
public int[] sample(int sampleSize) {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(
                LocalizedFormats.NUMBER_OF_SAMPLES, sampleSize);
    }
    int[] out = new int[sampleSize];
    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }
    return out;
}
 
Example #24
Source File: jMutRepair_008_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation generates the sample by calling
 * {@link #sample()} in a loop.
 */
public int[] sample(int sampleSize) {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(
                LocalizedFormats.NUMBER_OF_SAMPLES, sampleSize);
    }
    int[] out = new int[sampleSize];
    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }
    return out;
}
 
Example #25
Source File: JGenProg2015_003_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation generates the sample by calling
 * {@link #sample()} in a loop.
 */
public int[] sample(int sampleSize) {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(
                LocalizedFormats.NUMBER_OF_SAMPLES, sampleSize);
    }
    int[] out = new int[sampleSize];
    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }
    return out;
}
 
Example #26
Source File: Cardumen_00109_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Create a normal distribution using the given mean, standard deviation and
 * inverse cumulative distribution accuracy.
 *
 * @param mean Mean for this distribution.
 * @param sd Standard deviation for this distribution.
 * @param inverseCumAccuracy Inverse cumulative probability accuracy.
 * @throws NotStrictlyPositiveException if {@code sd <= 0}.
 * @since 2.1
 */
public NormalDistribution(double mean, double sd, double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    if (sd <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.STANDARD_DEVIATION, sd);
    }

    this.mean = mean;
    standardDeviation = sd;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example #27
Source File: jMutRepair_0033_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation generates the sample by calling
 * {@link #sample()} in a loop.
 */
public int[] sample(int sampleSize) {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(
                LocalizedFormats.NUMBER_OF_SAMPLES, sampleSize);
    }
    int[] out = new int[sampleSize];
    for (int i = 0; i < sampleSize; i++) {
        out[i] = sample();
    }
    return out;
}
 
Example #28
Source File: Cardumen_0039_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Create a normal distribution using the given mean, standard deviation and
 * inverse cumulative distribution accuracy.
 *
 * @param mean Mean for this distribution.
 * @param sd Standard deviation for this distribution.
 * @param inverseCumAccuracy Inverse cumulative probability accuracy.
 * @throws NotStrictlyPositiveException if {@code sd <= 0}.
 * @since 2.1
 */
public NormalDistribution(double mean, double sd, double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    if (sd <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.STANDARD_DEVIATION, sd);
    }

    this.mean = mean;
    standardDeviation = sd;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example #29
Source File: Cardumen_00215_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Create a normal distribution using the given mean, standard deviation and
 * inverse cumulative distribution accuracy.
 *
 * @param mean Mean for this distribution.
 * @param sd Standard deviation for this distribution.
 * @param inverseCumAccuracy Inverse cumulative probability accuracy.
 * @throws NotStrictlyPositiveException if {@code sd <= 0}.
 * @since 2.1
 */
public NormalDistribution(double mean, double sd, double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    if (sd <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.STANDARD_DEVIATION, sd);
    }

    this.mean = mean;
    standardDeviation = sd;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example #30
Source File: JGenProg2017_0070_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Generate a random sample from the distribution.
 *
 * @param sampleSize the number of random values to generate.
 * @return an array representing the random sample.
 * @throws NotStrictlyPositiveException if {@code sampleSize} is not
 * positive.
 */
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
    if (sampleSize <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
                sampleSize);
    }

    final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize);

    for (int i = 0; i < sampleSize; i++) {
    }

    return out;

}