randomGenerator = cern.jet.random.tdouble.AbstractDoubleDistribution.makeDefaultGenerator(); this.my_RandomGenerator = randomGenerator;
/** * Equivalent to <tt>nextDouble()</tt>. This has the effect that * distributions can now be used as function objects, returning a random * number upon function evaluation. */ public double apply(double dummy) { return nextDouble(); }
/** * Equivalent to <tt>nextInt()</tt>. This has the effect that distributions * can now be used as function objects, returning a random number upon * function evaluation. */ public int apply(int dummy) { return nextInt(); }
randomGenerator = cern.jet.random.tdouble.AbstractDoubleDistribution.makeDefaultGenerator(); this.my_RandomGenerator = randomGenerator;
/** * Equivalent to <tt>nextDouble()</tt>. This has the effect that * distributions can now be used as function objects, returning a random * number upon function evaluation. */ public double apply(double dummy) { return nextDouble(); }
/** * Equivalent to <tt>nextInt()</tt>. This has the effect that distributions * can now be used as function objects, returning a random number upon * function evaluation. */ public int apply(int dummy) { return nextInt(); }
/** * Chooses exactly one random element from successive blocks of * <tt>weight</tt> input elements each. For example, if weight==2, and the * input is 5*2=10 elements long, then chooses 5 random elements from the 10 * elements such that one is chosen from the first block, one from the * second, ..., one from the last block. weight == 1.0 --> all elements are * consumed (sampled). 10.0 --> Consumes one random element from successive * blocks of 10 elements each. Etc. * * @param weight * the weight. * @param randomGenerator * a random number generator. Set this parameter to <tt>null</tt> * to use the default random number generator. */ public WeightedDoubleRandomSampler(int weight, DoubleRandomEngine randomGenerator) { if (randomGenerator == null) randomGenerator = cern.jet.random.tdouble.AbstractDoubleDistribution.makeDefaultGenerator(); this.generator = new DoubleUniform(randomGenerator); setWeight(weight); }
/** * Returns a random number from the distribution; returns * <tt>(int) Math.round(nextDouble())</tt>. Override this method if * necessary. */ public int nextInt() { return (int) Math.round(nextDouble()); }
/** * Chooses exactly one random element from successive blocks of * <tt>weight</tt> input elements each. For example, if weight==2, and the * input is 5*2=10 elements long, then chooses 5 random elements from the 10 * elements such that one is chosen from the first block, one from the * second, ..., one from the last block. weight == 1.0 --> all elements are * consumed (sampled). 10.0 --> Consumes one random element from successive * blocks of 10 elements each. Etc. * * @param weight * the weight. * @param randomGenerator * a random number generator. Set this parameter to <tt>null</tt> * to use the default random number generator. */ public WeightedDoubleRandomSampler(int weight, DoubleRandomEngine randomGenerator) { if (randomGenerator == null) randomGenerator = cern.jet.random.tdouble.AbstractDoubleDistribution.makeDefaultGenerator(); this.generator = new DoubleUniform(randomGenerator); setWeight(weight); }
/** * Returns a random number from the distribution; returns * <tt>(int) Math.round(nextDouble())</tt>. Override this method if * necessary. */ public int nextInt() { return (int) Math.round(nextDouble()); }
throw new IllegalArgumentException("count must not be greater than n"); if (randomGenerator == null) randomGenerator = cern.jet.random.tdouble.AbstractDoubleDistribution.makeDefaultGenerator();
throw new IllegalArgumentException("count must not be greater than n"); if (randomGenerator == null) randomGenerator = cern.jet.random.tdouble.AbstractDoubleDistribution.makeDefaultGenerator();
for (long t = times; --t >= 0;) { DoubleRandomSampler sampler = new DoubleRandomSampler(n, N, low, cern.jet.random.tdouble.AbstractDoubleDistribution.makeDefaultGenerator()); for (long i = 0; i < chunks; i++) { sampler.nextBlock(chunkSize, values, 0);
for (long t = times; --t >= 0;) { DoubleRandomSampler sampler = new DoubleRandomSampler(n, N, low, cern.jet.random.tdouble.AbstractDoubleDistribution.makeDefaultGenerator()); for (long i = 0; i < chunks; i++) { sampler.nextBlock(chunkSize, values, 0);
/** * Randomly permutes the part of the receiver between <code>from</code> * (inclusive) and <code>to</code> (inclusive). * * @param from * the index of the first element (inclusive) to be permuted. * @param to * the index of the last element (inclusive) to be permuted. * @exception IndexOutOfBoundsException * index is out of range ( * <tt>size()>0 && (from<0 || from>to || to>=size())</tt> * ). */ public void shuffleFromTo(int from, int to) { checkRangeFromTo(from, to, size()); cern.jet.random.tdouble.DoubleUniform gen = new cern.jet.random.tdouble.DoubleUniform( AbstractDoubleDistribution.makeDefaultGenerator()); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) double tmpElement = getQuick(random); setQuick(random, getQuick(i)); setQuick(i, tmpElement); } }
/** * Randomly permutes the part of the receiver between <code>from</code> * (inclusive) and <code>to</code> (inclusive). * * @param from * the index of the first element (inclusive) to be permuted. * @param to * the index of the last element (inclusive) to be permuted. * @exception IndexOutOfBoundsException * index is out of range ( * <tt>size()>0 && (from<0 || from>to || to>=size())</tt> * ). */ public void shuffleFromTo(int from, int to) { checkRangeFromTo(from, to, size()); cern.jet.random.tdouble.DoubleUniform gen = new cern.jet.random.tdouble.DoubleUniform( AbstractDoubleDistribution.makeDefaultGenerator()); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) double tmpElement = getQuick(random); setQuick(random, getQuick(i)); setQuick(i, tmpElement); } }
cern.colt.buffer.tdouble.DoubleBuffer buffer) { if (randomGenerator == null) randomGenerator = AbstractDoubleDistribution.makeDefaultGenerator(); buffer.clear();
cern.colt.buffer.tdouble.DoubleBuffer buffer) { if (randomGenerator == null) randomGenerator = AbstractDoubleDistribution.makeDefaultGenerator(); buffer.clear();
cern.jet.random.tdouble.engine.DoubleRandomEngine randomGenerator, DoubleBinBinFunction1D function) { if (randomGenerator == null) randomGenerator = AbstractDoubleDistribution.makeDefaultGenerator();
cern.jet.random.tdouble.engine.DoubleRandomEngine randomGenerator, DoubleBinBinFunction1D function) { if (randomGenerator == null) randomGenerator = AbstractDoubleDistribution.makeDefaultGenerator();