Gets bounded number.

@param random              the random
@param inclusiveLowerBound the inclusive lower bound
@param exclusiveUpperBound the exclusive upper bound
@return the bounded number
19147
public static int getBoundedNumber(Random random, int inclusiveLowerBound,
            int exclusiveUpperBound) {
        return random.nextInt(exclusiveUpperBound - inclusiveLowerBound) +
                inclusiveLowerBound;
    }
537179
public static double randomDouble(double min, double max, int scale, RoundingMode roundingMode) {
		return NumberUtil.round(randomDouble(min, max), scale, roundingMode).doubleValue();
	}
724362
public static String getRandomNumStr(BaseProducer baseProducer, int max, int paddingSize) {
		int rndNum = baseProducer.randomBetween(1, max);
		String numStr = "" + rndNum;
		while (numStr.length() < paddingSize) {
			numStr = "0" + numStr;
		}
		return numStr;
	}
238091
def randbetween(lower: int, upper: int) -> int:
    
    if not isinstance(lower, int) or not isinstance(upper, int):
        raise TypeError('lower and upper must be integers')
    if lower < 0 or upper <= 0:
        raise ValueError('lower and upper must be greater than zero')

    return randbelow(upper - lower + 1) + lower
57416
function(max) {
	// gives a number between 0 (inclusive) and max (exclusive)
	var rand = crypto.randomBytes(1)[0];
	while (rand >= 256 - (256 % max)) {
		rand = crypto.randomBytes(1)[0];
	}
	return rand % max;
}
416248
public static long randomLongLessThan(long maxExclusive) {
    checkArgument(
        maxExclusive > Long.MIN_VALUE, "Cannot produce long less than %s", Long.MIN_VALUE);
    return randomLong(Long.MIN_VALUE, maxExclusive);
  }
504761
@Override
	public double getQuantile(double quantile, RandomVariable probabilities) {
		return ((RandomVariableAAD) getRandomVariableInterface()).getRandomVariableInterface().getQuantile(quantile, probabilities);
	}
193278
@Override
	public double getQuantileExpectation(double quantileStart, double quantileEnd) {
		return ((RandomVariableDifferentiableAADStochasticNonOptimized) getValues()).getValues().getQuantileExpectation(quantileStart, quantileEnd);
	}
98566
@Override
	public double getQuantile(double quantile, RandomVariable probabilities) {
		return ((RandomVariableDifferentiableAADStochasticNonOptimized) getValues()).getValues().getQuantile(quantile, probabilities);
	}
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);
  }
333583
public static String randomAlphaNumString(int length) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < length; i++) {
      sb.append(ALPHANUM.charAt(RANDOM.nextInt(ALPHANUM.length())));
    }
    return sb.toString();
  }
412844
public static String getRandomString(int numberOfLetters, char[] alphabet, boolean includeNumbers) {
        StringBuilder builder = new StringBuilder();
        
        int upperRange = alphabet.length - 1;
        
        // make sure first character is not a number
        builder.append(alphabet[generator.nextInt(upperRange)]);
        
        if (includeNumbers) {
            upperRange += NUMBERS.length;
        }
        
        for (int i = 1; i < numberOfLetters; i++) {
            int letterIndex = generator.nextInt(upperRange);
            
            if (letterIndex > alphabet.length - 1) {
                builder.append(NUMBERS[letterIndex - alphabet.length]);
            } else {
                builder.append(alphabet[letterIndex]);
            }
        }
        
        return builder.toString();
    }
482844
public static int randomInt(int lo, int hi) {
        return (Math.abs(random.nextInt()) % (hi - lo + 1)) + lo;
    }
678236
@Override
	public double integrate(DoubleUnaryOperator integrand) {
		double	lowerBound			= getLowerBound();
		double	upperBound			= getUpperBound();
		double	range				= upperBound-lowerBound;
		int		numberOfIntervalls	= (int) ((numberOfEvaluationPoints-1) / 2.0);

		double fullIntervall = range / numberOfIntervalls;
		double halfIntervall = 0.5 * fullIntervall;

		IntStream intervals = IntStream.range(1, numberOfIntervalls);
		if(useParallelEvaluation) {
			intervals = intervals.parallel();
		}

		double sum = intervals.mapToDouble(
				new IntToDoubleFunction() {
					@Override
					public double applyAsDouble(int i) {
						return 2 * integrand.applyAsDouble(lowerBound + i * fullIntervall + halfIntervall) + integrand.applyAsDouble(lowerBound + i * fullIntervall);
					}
				}
				).sum();

		sum += 2.0 * integrand.applyAsDouble(lowerBound + halfIntervall);

		return (integrand.applyAsDouble(lowerBound) + integrand.applyAsDouble(upperBound) + 2.0 * sum) / 6.0 * fullIntervall;
	}
648693
@Override
	public double integrate(DoubleUnaryOperator integrand) {
		double	lowerBound			= getLowerBound();
		double	upperBound			= getUpperBound();
		double	range				= upperBound-lowerBound;

		// Create random number sequence generator (we use MersenneTwister)
		MersenneTwister		mersenneTwister		= new MersenneTwister(seed);

		DoubleStream randomNumberSequence = IntStream.range(0, numberOfEvaluationPoints).sequential().mapToDouble(new IntToDoubleFunction() {
			@Override
			public double applyAsDouble(int i) {
				return mersenneTwister.nextDouble();
			}
		});

		return randomNumberSequence.map(new DoubleUnaryOperator() {
			@Override
			public double applyAsDouble(double x) {
				return (integrand.applyAsDouble(lowerBound + x * range));
			}
		}).sum() * range / numberOfEvaluationPoints;
	}
416500
public static IntDoubleVector getRandomBernoulliDirection(int p) {
        IntDoubleVector e = new IntDoubleDenseVector(p);
        for (int i=0; i<p; i++) {
            // Bernoulli distribution chooses either positive or negative 1.
            e.set(i, (Prng.nextBoolean()) ? 1 : -1);
        }
        return e;
    }
32878
public int getRandomInt() {
    	
        Integer newInt = null;
        do {
        	newInt = randomGenerator.nextInt();
        } while(this.previousRandomInts.contains(newInt));
        this.previousRandomInts.add(newInt);
        return newInt.intValue();
    }