Replies a random value that respect
the current stochastic law.

@param minX is the lower bound
@param maxX is the upper bound
@return a value depending of the stochastic law parameters
@throws MathException when math definition error.
174989
@Pure
	@Inline(value = "StochasticGenerator.generateRandomValue(new UniformStochasticLaw(($1), ($2)))",
			imported = {StochasticGenerator.class, UniformStochasticLaw.class})
	public static double random(double minX, double maxX) throws MathException {
		return StochasticGenerator.generateRandomValue(new UniformStochasticLaw(minX, maxX));
	}
615859
public static int getRandomInteger(int min, int max) {
		Random r = new Random();
		return r.nextInt(max - min + 1) + min;
	}
396787
@Override
    public long getMaxX() {
        if (!excludeOutOfRangeValues) {
            return super.getMaxX();
        } else {
            long retMax = 0;
            Iterator<Long> iter = values.keySet().iterator();

            if (iter.hasNext()) {
                retMax = iter.next();
            }
            long excludeValue = getGranulationValue() * excludeCount;
            while (iter.hasNext()) {
                long value = iter.next();

                if (value > retMax) {
                    if ((value - retMax) < excludeValue) {
                        retMax = value;
                    }
                }
            }
            return retMax;
        }
    }
480301
public static function randomInt(int $min, int $max): int
    {
        if ($max <= $min) {
            throw new \Exception('Minimum equal or greater than maximum!');
        }
        if ($max < 0 || $min < 0) {
            throw new \Exception('Only positive integers supported for now!');
        }

        $difference = $max - $min;
        for ($power = 8; pow(2, $power) < $difference; $power = $power * 2) {
        }
        $powerExp = $power / 8;
        do {
            $randDiff = hexdec(bin2hex(self::randomBytes($powerExp)));
        } while ($randDiff > $difference);
        return $min + $randDiff;
    }
691514
public static int argmax(double[] v) {
    assert (v.length > 0);
    int maxIndex = 0;
    double currentMax = v[0];
    for(int i = 1; i < v.length; i++) {
      final double x = v[i];
      if(x > currentMax) {
        maxIndex = i;
        currentMax = x;
      }
    }
    return maxIndex;
  }
403008
public void setMinMax(int min, int max)
    {
        if(min >= max)
            throw new IllegalArgumentException("The input minimum (" + min + ") must be less than the given max (" + max  + ")");
        this.min = min;
        this.max = max;
    }
1035253
public static void minMax(Integer min, Integer max) {
		if(!validation) return;
		Validate.notNull(min);
		Validate.notNull(max);
		if(min > max)
			throw new ParameterException(ErrorCode.RANGEVIOLATION, "Minumum is bigger than maximum.");
	}
367426
function (x, y) {
		return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
	}
6525
function(x, min, max) {
                    x = this._v(x, "r");
                    min = this._v(min, "r", 0);
                    max = this._v(max, "r", 1);
                    if(min > max) throw new Error("Minimum value cannot be greater than maximum value");

                    if(x < min || x > max) return 0;
                    if(min === max) return Infinity;


                    return 1/(max-min);
                }
1082312
public static void randomize(
        MutableDoubleTuple t, double min, double max, Random random)
    {
        double delta = max - min;
        for (int i=0; i<t.getSize(); i++)
        {
            t.set(i, min + random.nextDouble() * delta);
        }
    }
114675
public static function RAND($min = 0, $max = 0) {
		$min		= PHPExcel_Calculation_Functions::flattenSingleValue($min);
		$max		= PHPExcel_Calculation_Functions::flattenSingleValue($max);

		if ($min == 0 && $max == 0) {
			return (rand(0,10000000)) / 10000000;
		} else {
			return rand($min, $max);
		}
	}
407720
function (min, max) {
		min = (min != null ? min : 0);
		if (max == null) {
			var pow = this.exports.helpers.getPower(min) || 1;
			max = Math.pow(10, this.exports.generate.integer(pow, pow + 10));
		}
		var number = min;
		var diff = -min + max;
		if (!diff)
			return number;
		var add = Math.floor(Math.random() * Math.pow(10, this.exports.helpers.getPower(max) + 1)) % diff;
		return number + add;
	}
277326
public static int clamp(int value, int min, int max) {
		return Math.min(Math.max(min, value), max);
	}
1300159
public static int randomIntLessThan(int maxExclusive) {
    checkArgument(
        maxExclusive > Integer.MIN_VALUE, "Cannot produce int less than %s", Integer.MIN_VALUE);
    return randomInt(Integer.MIN_VALUE, maxExclusive);
  }
336821
public static int getRandomInteger(int min, int max)
    {
        Check.inferiorOrEqual(min, max);

        return min + RANDOM.nextInt(max + 1 - min);
    }
1141713
public final void setMaxValue(final int maxValue) {
        Condition.INSTANCE.ensureGreater(maxValue, getMinValue(),
                "The maximum value must be greater than the minimum value");
        this.maxValue = maxValue;
        setValue(Math.min(getValue(), maxValue));
    }
394517
public static double uniform(Random rng, double min, double max) {
        return rng.nextDouble() * (max - min) + min;
    }