/** * Returns a uniformly distributed random number in the open interval <tt>(from,to)</tt> (excluding <tt>from</tt> and * <tt>to</tt>). Pre conditions: <tt>from <= to</tt>. */ public double nextDoubleFromTo(double from, double to) { return from + (to - from) * randomDouble(); }
/** * Returns a uniformly distributed random number in the open interval <tt>(min,max)</tt> (excluding <tt>min</tt> and * <tt>max</tt>). */ @Override public double nextDouble() { return min + (max - min) * randomDouble(); }
/** * Returns a uniformly distributed random number in the closed interval * <tt>[from,to]</tt> (including <tt>from</tt> * and <tt>to</tt>). Pre conditions: <tt>from <= to</tt>. */ public int nextIntFromTo(int from, int to) { return (int) (from + (long) ((1L + to - from) * randomDouble())); }
/** Returns a uniformly distributed random <tt>boolean</tt>. */ public boolean nextBoolean() { return randomDouble() > 0.5; }
/** * Returns a uniformly distributed random number in the closed interval * <tt>[from,to]</tt> (including <tt>from</tt> * and <tt>to</tt>). Pre conditions: <tt>from <= to</tt>. */ public int nextIntFromTo(int from, int to) { return (int) (from + (long) ((1L + to - from) * randomDouble())); }
/** * Returns a uniformly distributed random number in the open interval <tt>(from,to)</tt> (excluding <tt>from</tt> and * <tt>to</tt>). Pre conditions: <tt>from <= to</tt>. */ public double nextDoubleFromTo(double from, double to) { return from + (to - from) * randomDouble(); }
/** * Returns a uniformly distributed random number in the open interval <tt>(min,max)</tt> (excluding <tt>min</tt> and * <tt>max</tt>). */ @Override public double nextDouble() { return min + (max - min) * randomDouble(); }
/** * Returns a uniformly distributed random number in the open interval <tt>(min,max)</tt> (excluding <tt>min</tt> and * <tt>max</tt>). */ @Override public double nextDouble() { return min + (max - min) * randomDouble(); }
/** * Returns a uniformly distributed random number in the open interval <tt>(from,to)</tt> (excluding <tt>from</tt> and * <tt>to</tt>). Pre conditions: <tt>from <= to</tt>. */ public double nextDoubleFromTo(double from, double to) { return from + (to - from) * randomDouble(); }
/** * Returns a uniformly distributed random number in the closed interval * <tt>[from,to]</tt> (including <tt>from</tt> * and <tt>to</tt>). Pre conditions: <tt>from <= to</tt>. */ public int nextIntFromTo(int from, int to) { return (int) ((long) from + (long) ((1L + (long) to - (long) from) * randomDouble())); }
/** Returns a uniformly distributed random <tt>boolean</tt>. */ public boolean nextBoolean() { return randomDouble() > 0.5; }
/** Returns a uniformly distributed random <tt>boolean</tt>. */ public boolean nextBoolean() { return randomDouble() > 0.5; }