/** * Constructs a mean-squared BreitWigner distribution. * * @param cut * </tt>cut==Double.NEGATIVE_INFINITY</tt> indicates "don't cut". */ public BreitWignerMeanSquare(double mean, double gamma, double cut, DoubleRandomEngine randomGenerator) { super(mean, gamma, cut, randomGenerator); this.uniform = new DoubleUniform(randomGenerator); }
/** * Constructs a mean-squared BreitWigner distribution. * * @param cut * </tt>cut==Double.NEGATIVE_INFINITY</tt> indicates "don't cut". */ public BreitWignerMeanSquare(double mean, double gamma, double cut, DoubleRandomEngine randomGenerator) { super(mean, gamma, cut, randomGenerator); this.uniform = new DoubleUniform(randomGenerator); }
/** * Returns a deep copy of the receiver; the copy will produce identical * sequences. After this call has returned, the copy and the receiver have * equal but separate state. * * @return a copy of the receiver. */ public Object clone() { BreitWignerMeanSquare copy = (BreitWignerMeanSquare) super.clone(); if (this.uniform != null) copy.uniform = new DoubleUniform(copy.randomGenerator); return copy; }
/** * Returns a deep copy of the receiver; the copy will produce identical * sequences. After this call has returned, the copy and the receiver have * equal but separate state. * * @return a copy of the receiver. */ public Object clone() { BreitWignerMeanSquare copy = (BreitWignerMeanSquare) super.clone(); if (this.uniform != null) copy.uniform = new DoubleUniform(copy.randomGenerator); return copy; }
/** * 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); }
/** * 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); }
/** * 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) { if (size == 0) return; checkRangeFromTo(from, to, size); cern.jet.random.tdouble.DoubleUniform gen = new cern.jet.random.tdouble.DoubleUniform( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); Object tmpElement; Object[] theElements = elements; int random; for (int i = from; i < to; i++) { random = gen.nextIntFromTo(i, to); // swap(i, random) tmpElement = theElements[random]; theElements[random] = theElements[i]; theElements[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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) boolean 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) int 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) int 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) char 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) long 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) byte 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) short 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) byte 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) long 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) boolean 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( new cern.jet.random.tdouble.engine.DRand(new java.util.Date())); for (int i = from; i < to; i++) { int random = gen.nextIntFromTo(i, to); // swap(i, random) char 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); } }
/** * 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); } }