creates a generator that returns numbers in the range $lower to $upper, inclusive

@param int $lower
@param int $upper
@return Generator
764774
public static function choose($lower, $upper)
    {
        return new self(function (Random $rng, $size) use ($lower, $upper) {
            $val = self::randRange($rng, $lower, $upper);
            $tree = self::intRoseTree($val);
            return $tree->filter(function ($x) use ($lower, $upper) {
                return $x >= $lower && $x <= $upper;
            });
        });
    }
350707
public function range($val, $lower, $upper, $id, $name = null) {
        if ($val < $lower || $val > $upper) {
            if (is_null($name))
                $name = ucwords($id);
            $this->add($id, "$name must be between $lower and $upper.");
            return false;
        }

        return true;
    }
1229658
static public function camelize($word,$upper=false)
 	{
		$word = strtolower($word);

		$preg = array(
			'/(.)(^|_|-)+(.)/e' => "strtolower('\\1').strtoupper('\\3')"
		);

		$word = preg_replace(array_keys($preg), array_values($preg), $word);
		if ($upper) return ucfirst($word);
		return $word;
	}
88693
public function notBetween($lower, $upper)
    {
        $lowerParameterName = $this->generateUniqueId();
        $upperParameterName = $this->generateUniqueId();

        return $this->rawDQL(
            "{$this->getColumn()} NOT BETWEEN :{$lowerParameterName} AND :{$upperParameterName}",
            [
                $lowerParameterName => $lower,
                $upperParameterName => $upper,
            ]
        );
    }
236663
public function getIterator(): Iterator
    {
        $map = $this->map;
        foreach ($map as $ordinal => $value) {
            yield ($this->enumeration)::byOrdinal($ordinal) => $value;
        }
    }
67132
public function calculate( $top, $bottom )
	{
		if( $top < $bottom )
			throw new InvalidArgumentException( 'Bottom Number must be lower than or equal to Top Number.' );
		else if( $top != (int) $top )
			throw new InvalidArgumentException( 'Top Number must be an Integer.' );
		else if( $bottom != (int) $bottom )
			throw new InvalidArgumentException( 'Bottom Number must be an Integer.' );
		else
		{
			$result	= Alg_Math_Factorial::calculate( $top ) / ( Alg_Math_Factorial::calculate( $bottom ) * Alg_Math_Factorial::calculate( $top - $bottom ) );
			return $result;
		}
	}
1347453
def make_tophat_ie (lower, upper):
    
    if not np.isfinite (lower):
        raise ValueError ('"lower" argument must be finite number; got %r' % lower)
    if not np.isfinite (upper):
        raise ValueError ('"upper" argument must be finite number; got %r' % upper)

    def range_tophat_ie (x):
        x = np.asarray (x)
        x1 = np.atleast_1d (x)
        r = ((lower <= x1) & (x1 < upper)).astype (x.dtype)
        if x.ndim == 0:
            return np.asscalar (r)
        return r

    range_tophat_ie.__doc__ = ('Ranged tophat function, left-inclusive and '
                               'right-exclusive. Returns 1 if %g <= x < %g, '
                               '0 otherwise.') % (lower, upper)
    return range_tophat_ie
492677
public function getIterator(): \Generator
    {
        foreach ($this->sourceIterable as $content) {
            try {
                yield $this->stream->write($content);
            } catch (\InvalidArgumentException $ex) {
                throw new \RuntimeException('The iterable generated values that are not writable', 0, $ex);
            }
        }
    }
69113
static function getWords($string, $lowercase = false) {

		$string = self::clean($string, ' ');

		// before an upper and a lower. FBar -> F Bar
		$string = preg_replace('/(.)([A-Z])([a-z])/', '$1 $2$3', $string);

		// between a lower and an upper. fooB -> foo B
		$string = preg_replace('/([a-z])([A-Z])/', '$1 $2', $string);

		// after any sequence of numbers.  45times -> 45 times
		$string = preg_replace('/([0-9])([^0-9])/', '$1 $2', $string);

		if ($lowercase) {
			$string = strtolower($string);
		}

		do {
			$string = str_replace('  ', ' ', $string, $count);
		} while ($count > 0);

		return explode(' ', $string);
	}
714047
public Range<T> rightHalfOpen(T lower, Optional<T> upper) {
        return new DenseRange<T>(sequencer, comparator, Endpoint.Include, lower, upper, Endpoint.Exclude);
    }
545557
private function computeLowerAndUpperBounds($range)
    {
        if (strpos($range, '/') !== false) {
            // support CIDR notation
            list($this->lowerInt, $this->upperInt) = $this->parseCidrRange($range);
        } elseif (strpos($range, '-') !== false) {
            // support for IP ranges like '10.0.0.0-10.0.0.255'
            list($this->lowerInt, $this->upperInt) = $this->parseHyphenRange($range);
        } elseif (($pos = strpos($range, '*')) !== false) {
            // support for IP ranges like '10.0.*'
            list($this->lowerInt, $this->upperInt) = $this->parseWildcardRange($range, $pos);
        } else {
            // assume we have a single address
            $this->lowerInt = ip2long($range);
            $this->upperInt = $this->lowerInt;
        }
    }
803522
public static function clamp( $x, $low, $high) {
        return $x < $low ? $low : ($x > $high ? $high : $x);
    }
636819
private void propagate(Layer lower, Layer upper) {
        for (int i = 0; i < upper.units; i++) {
            double sum = 0.0;
            for (int j = 0; j <= lower.units; j++) {
                sum += upper.weight[i][j] * lower.output[j];
            }

            if (upper == outputLayer) {
                upper.output[i] = sum;
            }

            else {
                if (activationFunction == ActivationFunction.LOGISTIC_SIGMOID) {
                    upper.output[i] = Math.logistic(sum);
                }
                else if (activationFunction==ActivationFunction.TANH){
                    upper.output[i]=(2*Math.logistic(2*sum))-1;
                }
            }
        }
    }
834099
protected function get()
    {
        $a = 0;
        $b = 1;
        $to = $this->getMaxLimit();
        while (0 < $to) {
            yield $a;

            list($a, $b) = [$b, $a + $b];
            --$to;
        }
    }
119108
@Override
    public final Integer generate(final Integer max) {
        final Integer result;

        if (max < LOWER_LIMIT) {
            LOGGER.warn(
                    "Received {} as maximum value, but this is lower than {}",
                    max, LOWER_LIMIT);
            result = 0;
        } else {
            result = random.nextInt(Math.abs(LOWER_LIMIT - max) + 1)
                    + LOWER_LIMIT;
        }

        return result;
    }
253137
public function random($min = false, $max = false)
    {
        if ($min === false) {
            $min = new BigInteger(0);
        }
        if ($max === false) {
            $max = new BigInteger(0x7FFFFFFF);
        }
        $compare = $max->compare($min);
        if (! $compare) {
            return $this->protectedNormalize($min);
        } elseif ($compare < 0) {
            // if $min is bigger then $max, swap $min and $max
            $temp = $max;
            $max = $min;
            $min = $temp;
        }
        static $one;
        if (! isset($one)) {
            $one = new BigInteger(1);
        }
        $max = $max->subtract($min->subtract($one));
        $size = strlen(ltrim($max->toBytes(), chr(0)));
        /*
         * doing $random % $max doesn't work because some numbers will be more likely to occur than others.
         * eg. if $max is 140 and $random's max is 255 then that'd mean both $random = 5 and $random = 145
         * would produce 5 whereas the only value of random that could produce 139 would be 139. ie.
         * not all numbers would be equally likely. some would be more likely than others.
         *
         * creating a whole new random number until you find one that is within the range doesn't work
         * because, for sufficiently small ranges, the likelihood that you'd get a number within that range
         * would be pretty small. eg. with $random's max being 255 and if your $max being 1 the probability
         * would be pretty high that $random would be greater than $max.
         *
         * phpseclib works around this using the technique described here:
         *
         *
         */
        $random_max = new BigInteger(chr(1) . str_repeat("\0", $size), 256);
        $random = $this->protectedRandomNumberHelper($size);
        list ($max_multiple) = $random_max->divide($max);
        $max_multiple = $max_multiple->multiply($max);
        while ($random->compare($max_multiple) >= 0) {
            $random = $random->subtract($max_multiple);
            $random_max = $random_max->subtract($max_multiple);
            $random = $random->bitwiseLeftShift(8);
            $random = $random->add($this->protectedRandomNumberHelper(1));
            $random_max = $random_max->bitwiseLeftShift(8);
            list ($max_multiple) = $random_max->divide($max);
            $max_multiple = $max_multiple->multiply($max);
        }
        list ($random) = $random->divide($max);
        return $this->protectedNormalize($random->add($min));
    }
466036
def generate_key(low=7, high=10, lower_only=False):
    
    return random_alphanum(length=randint(7, 10), lower_only=lower_only)