Get a random value from an interval.

@param min The minimum value.
@param max The maximum value (positive and superior or equal to min).
@return A value between min inclusive and max inclusive.
336821
public static int getRandomInteger(int min, int max)
    {
        Check.inferiorOrEqual(min, max);

        return min + RANDOM.nextInt(max + 1 - min);
    }
525251
protected static function _rand($min, $max)
    {
        if (version_compare(PHP_VERSION, '7.0.0', 'ge')) {
            $value = random_int($min, $max);
        } else {
            $value = mt_rand($min, $max);
        }

        return $value;
    }
96646
public static long randomLong(final long min, final long max) {

        return Math.round(Math.random() * (max - min) + min);
    }
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);
                }
508669
private function between($value, $min = null, $max = null) {

        $value = intval($value);

        if ($min !== null && $max !== null) {
            return $value >= intval($min) && $value <= intval($max);
        }

        if ($min !== null) {
            return intval($min) <= $value;
        }

        if ($max !== null) {
            return $value <= intval($max);
        }
        return false;
    }
9459
function randomBetween(_min, _max) {
	var max, min;
	
	if(_min > _max){
		min = _max;	
		max = _min;
	}
	else if(_min === _max){
		return _min;
	}
	else{
		max = _max;
		min = _min;
	}
    
    var r = Math.floor(Math.random() * max) + min;
    
    if(r > max)
    	return max;
    if(r < min)
    	return min;
    else
    	return r;
}
248632
public static String randomString(int length, int min, int max) {
      return randomString(length, min, max, CharMatcher.ANY);
   }
87293
public static long random(long min, long max) {
        return Math.round(ThreadLocalRandom.current().nextDouble()
                * (max - min) + min);
    }
1196299
public static function getRandomInt($min = 0, $max = null)
    {
        $rand = null;

        if (function_exists('random_int')) {
            try {
                if (!isset($max)) {
                    $max = PHP_INT_MAX;
                }
                $rand = random_int($min, $max);
            } catch (Exception $e) {
                // If none of the crypto sources are available, an Exception will be thrown.
                $rand = null;
            }
        }

        if (!isset($rand)) {
            if (function_exists('mt_rand')) {
                if (!isset($max)) {
                    $max = mt_getrandmax();
                }
                $rand = mt_rand($min, $max);
            } else {
                if (!isset($max)) {
                    $max = getrandmax();
                }

                $rand = rand($min, $max);
            }
        }

        return $rand;
    }
595024
public int getInt(final int min, final int max) {
		return min(min, max) + getInt(abs(max - min));
	}
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;
	}
806867
function Random(Max, Min){
    var Range = Max - Min;
    var Rand = Math.random();
    return (Min + Math.round(Rand * Range));
}
643213
function getRandomNumber(min, max) {
  return Math.round(Math.random() * (max - min) + min);
}
533047
public static double randomNum(int x, int y) {
        int max = x + 1;
        int min = y + 1;
        Random random = new Random();
        int result = random.nextInt(max)%(max-min+1) + min;
        return result - 1;
    }
1297389
public static function randNum($min = null, $max = null)
    {
        mt_srand((double) microtime() * 1000000);
        if ($min === null || $max === null) {
            return mt_rand();
        } else {
            return mt_rand($min, $max);
        }
    }
993800
public static int checkBetween(int value, int min, int max) {
		if (value < min || value > max) {
			throw new IllegalArgumentException(StrUtil.format("Length must be between {} and {}.", min, max));
		}
		return value;
	}
1251880
public static function random($min, $max = null)
    {
        if (String::isEmpty($max) ||
            $max > getrandmax()) {
            $max = getrandmax();
        }

        return rand($min, $max);
    }