Return $quantity UNIQUE random value between $min and $max.
Return null on failure.

@param int $min = 0
@param int $max
@param int $quantity = 1
@throws \Exception

@return int[]|null
341865
static public function getUniqueRandomValues(int $min = 0, int $max, int $quantity = 1):? array
    {
        if ($min > $max || $quantity < 0) {
            return null;
        }

        $rand = [];

        while (count($rand) < $quantity) {
            $r = random_int($min, $max);

            if (!in_array($r, $rand)) {
                $rand[] = $r;
            }
        }

        return $rand;
    }
1288127
public static function number(int $min = 0, int $max = PHP_INT_MAX) : int
    {
        if ($max === $min) {
            return $max;
        }
        $rand = static::bytes(4);
        $rand = hexdec(bin2hex($rand));

        return $min + abs($rand % ($max - $min + 1));
    }
826823
public static function floats(float $min, float $max, int $n = 10) : array
    {
        if (($max - $min) < 0.) {
            throw new InvalidArgumentException('Maximum cannot be'
                . ' less than minimum.');
        }

        if ($n < 1) {
            throw new InvalidArgumentException('Cannot generate less'
                . ' than 1 parameter.');
        }

        $min = (int) round($min * self::PHI);
        $max = (int) round($max * self::PHI);

        $distribution = [];

        for ($i = 0; $i < $n; $i++) {
            $distribution[] = rand($min, $max) / self::PHI;
        }

        return $distribution;
    }
1360336
public function orWhereBetween(string $key, int $min, int $max): QueryBuilder
    {
        $values = ['min' => $min, 'max' => $max];
        $this->addWhere($key, 'BETWEEN', $values, 'OR');
        return$this;
    }
1204232
public function generate($min = 0,$max = null)
    {
        if($max === null) {
            $max = $this->max;
        }
        
        if($min === null) {
            $min = $this->min;
        }
        
        
        return rand($min,$max);
    }
1024293
public int getNumberBetween(final int min, final int max) {

    if (max < min) {
      throw new IllegalArgumentException(String.format("Minimum must be less than minimum (min=%d, max=%d)", min, max));
    }
    if (max == min) {
      return min;
    }

    return min + random.nextInt(max - min);
  }
1215465
public function getRand($min = 0, $max = 0x7fffffff)
    {
        $t = ($this->x ^ ($this->x << 11)) & 0x7fffffff;
        $this->x = $this->y;
        $this->y = $this->z;
        $this->z = $this->w;
        $this->w = ( $this->w ^ ($this->w >> 19) ^ ( $t ^ ( $t >> 8 )) );
        return $this->w % ($max - $min + 1) + $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;
    }
1253014
public function whereBetween($field, $min, $max)
    {
        if ($min === null || $min === '') {
            return $max === null || $max === '' ? $this : $this->whereCmp($field, '<=', $max);
        } elseif ($max === null || $max === '') {
            return $min === null || $min === '' ? $this : $this->whereCmp($field, '>=', $min);
        }

        $this->_filters[] = [$field => ['$gte' => $this->normalizeValue($field, $min), '$lte' => $this->normalizeValue($field, $max)]];

        return $this;
    }
393815
public function length($min, $max = PHP_INT_MAX)
    {
        return $this->markErrorIf(strlen($this->value) < $min || strlen($this->value) > $max);
    }
1251880
public static function random($min, $max = null)
    {
        if (String::isEmpty($max) ||
            $max > getrandmax()) {
            $max = getrandmax();
        }

        return rand($min, $max);
    }
960532
public static function integer($min=NULL,$max=NULL,$prompt=NULL){
		if(\is_int($min) && \is_int($max))
			return new Rule("integer[{$min}..{$max}]",$prompt);
		return new Rule("integer",$prompt);
	}
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;
    }
295301
private static function calculateMeanMicroAmount($min, $max)
    {
        if ($min === null || $max === null) {
            return null;
        }
        if ($min->getMicroAmount() === null
            || $max->getMicroAmount() === null) {
            return null;
        }

        return ($min->getMicroAmount() + $max->getMicroAmount()) / 2;
    }
656988
private static function calculateMean($min, $max)
    {
        if ($min === null || $max === null) {
            return null;
        }

        return ($min + $max) / 2;
    }
239601
public static function bound($number, $min = 0, $max = PHP_INT_MAX)
    {
        $number = (int)$number;
        $min = (int)$min;
        $max = (int)$max;

        return min(max($number, $min), $max);
    }
805214
public function between($min, $max) {
        $this->check_role = 'between';
        $this->p1 = $min;
        $this->p2 = $max;
        $result = $this->value >= $min && $this->value <= $max;
        $this->checkResult($result);
        return $this;
    }