Verify the count of the array value is within the range

@param $min
@param int $max
@return Validator
505103
public function countArray($min, $max = PHP_INT_MAX)
    {
        return $this->markErrorIf(!is_array($this->value)||count($this->value) < $min || count($this->value) > $max, false);
    }
363183
public function getRandomNumber($min = -1, $max = -1) {
		if ($this->nextRandomNumber >= 0 && $this->nextRandomNumber >= ($min == -1 ? 0 : $min) && $this->nextRandomNumber <= ($max == -1 ? $this->getMaxRandomNumber() : $max)) {
			$rand = $this->nextRandomNumber;
			$this->nextRandomNumber = -1;

			return $rand;
		}

		return $this->realRandom->getRandomNumber($min, $max);
	}
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;
    }
1251880
public static function random($min, $max = null)
    {
        if (String::isEmpty($max) ||
            $max > getrandmax()) {
            $max = getrandmax();
        }

        return rand($min, $max);
    }
302830
public static function isRequiredNumericRange($value, $min, $max)
    {
        return is_numeric($value) && $min <= $value && $max >= $value;
    }
544648
public function zRemRangeByScore($key, $min, $max) {
        return $this->getHandler($this->judge(__FUNCTION__))->zRemRangeByScore($key, $min, $max);
    }
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);
		}
	}
981716
public static function limit($number, $min, $max): int
    {
        return self::max(self::min($number, $min), $max);
    }
904223
public function min($min) {
        $this->check_role = 'min';
        $this->p1 = $min;
        $result = $this->value >= $min;
        $this->checkResult($result);
        return $this;
    }
683738
public function between($min, $max)
    {
        $this->doCheck(function ($value) use ($min, $max) {
            $this->throwExceptionIfFalse(
                $this->isBetween($value, $min, $max),
                'Failed assertion that %s is between %s and %s', $value, $min, $max
            );
        });

        return $this;
    }
446984
public static function rangeCount($value, int $minCount, int $maxCount): bool
    {
        if (!static::isCountable($value)) {
            return false;
        }

        $count = count($value);

        if ($count < $minCount) {
            return false;
        }
        if ($count > $maxCount) {
            return false;
        }

        return true;
    }
960904
public function havingBetween(string $column, int $min, int $max)
    {
        $instance = $this->havingStrategyInstance();

        $instance->havingStrategy()->havingBetween($column, $min, $max);

        return $instance;
    }
1173727
public static function generateRandomInt($min, $max)
    {
        $range = $max - $min;
        $bits = $bytes = $mask = $val = 0;
        while ($range > 0) {
            if ($bits % 8 === 0) {
               ++$bytes;
            }
            ++$bits;
            $range >>= 1;
            $mask = $mask << 1 | 1;
        }
        $valueShift = $min;

        do {
            if ($attempts > 128) {
                throw new \Exception('Could not generate valid random integer');
            }
            $randomByteString = self::generateCryptoKey($bytes);

            $val = 0;
            for ($i = 0; $i < $bytes; ++$i) {
                $val |= ord($randomByteString[$i]) << ($i * 8);
            }

            $val &= $mask;
            $val += $valueShift;

            ++$attempts;

        } while (!is_int($val) || $val > $max || $val < $min);

        return (int) $val;
    }
611962
public function length($min, $max) {
        $this->check_role = 'length';
        $this->rule = "$min,$max";
        if (is_array($this->value)) {
            $length = count($this->value);
        } elseif ($this->value instanceof File) {
            $length = filesize($this->value->path_tmp);
        } else {
            $length = mb_strlen((string)$this->value);
        }
        $result = $length < $min || $length > $max;
        $this->checkResult($result);
        return $this;
    }
828826
public function checkBetween($value, $min, $max)
    {
        return $this->checkMin($value, $min) && $this->checkMax($value, $max);
    }
805226
public function setIDRange($min, $max)
    {
        assert(is_numeric($min));
        assert(is_numeric($max));
        assert($min <= $max);
        $this->_min_id = $min;
        $this->_max_id = $max;

        return $this;
    }
960950
protected function keep_within($value, $min, $max) {
        if ($value < $min) {
            return $min;
        }
        if ($value > $max) {
            return $max;
        }
        return $value;
    }