Generate an array with a range of numbers. Can apply a step interval to increase/decrease with larger increments.

@param int $start
@param int $stop
@param int $step
@param bool $index
@return array
17032
public static function range($start, $stop, $step = 1, $index = true) {
        $array = array();

        if ($stop > $start) {
            for ($i = $start; $i <= $stop; $i += $step) {
                if ($index) {
                    $array[$i] = $i;
                } else {
                    $array[] = $i;
                }
            }

        } else if ($stop < $start) {
            for ($i = $start; $i >= $stop; $i -= $step) {
                if ($index) {
                    $array[$i] = $i;
                } else {
                    $array[] = $i;
                }
            }
        }

        return $array;
    }
1198399
function range (start, stop, step) {
  var index, len
  var result = []
  var args = arguments
  if (args.length < 2) {
    stop = args[0]
    start = 0
  }
  index = start >> 0
  len = stop >> 0
  if (index < stop) {
    step = step >> 0 || 1
    for (; index < len; index += step) {
      result.push(index)
    }
  }
  return result
}
271411
public function range($start, $stop, $descending = false, $withScores = null){
        if(!$descending){
            return $this->getConnection()->getSlave()->zrange($this->name, $start, $stop, $withScores);
        }else{
            return $this->getConnection()->getSlave()->zrevrange($this->name, $start, $stop, $withScores);
        }
    }
446728
private void sieveSingle(int limit, int start, int step) {
        while(start < limit) {
            set(start);
            start += step;
        }
    }
1331586
def arange(start,stop,step=1,**kwargs):
    
    expand_value = 1 if step > 0 else -1
    return matlabarray(np.arange(start,
                                 stop+expand_value,
                                 step,
                                 **kwargs).reshape(1,-1),**kwargs)
291599
def erange(start, end, steps):
    
    if start == 0:
        print("Nothing you multiply zero by gives you anything but zero. Try picking something small.")
        return None
    if end == 0:
        print("It takes an infinite number of steps to get to zero. Try a small number?")
        return None

    # figure out our multiplication scale
    x = (1.0*end/start)**(1.0/(steps-1))

    # now generate the array
    ns = _n.array(list(range(0,steps)))
    a =  start*_n.power(x,ns)

    # tidy up the last element (there's often roundoff error)
    a[-1] = end

    return a
172910
public function getStage($index)
    {
        if ( ! isset($this->stages[$index])) {
            throw new \OutOfRangeException("Could not find stage with index {$index}.");
        }

        return $this->stages[$index];
    }
977071
public static INDArrayIndex[] createFromStartAndEnd(INDArray start, INDArray end) {
        if (start.length() != end.length())
            throw new IllegalArgumentException("Start length must be equal to end length");
        else {
            if (start.length() > Integer.MAX_VALUE)
                throw new ND4JIllegalStateException("Can't proceed with INDArray with length > Integer.MAX_VALUE");

            INDArrayIndex[] indexes = new INDArrayIndex[(int) start.length()];
            for (int i = 0; i < indexes.length; i++) {
                indexes[i] = NDArrayIndex.interval(start.getInt(i), end.getInt(i));
            }
            return indexes;
        }
    }
754363
public function zRevRange($key, $start = 0, $stop = -1, $withScores = false) {
        return $this->_zRange('zrevrange', $key, $start, $stop, $withScores);
    }
77193
public static function range(float $start, float $end, float $interval = 1.) : self
    {
        if ($interval <= 0.) {
            throw new InvalidArgumentException('Interval must be greater'
                 . " than 0, $interval given.");
        }

        return static::quick(range($start, $end, $interval));
    }
400602
public function removeRange(int $start, int $end): bool {
        $removed = true;
        foreach ($this->array as $key => $item) {
            if ($key >= $start && $key <= $end) {
                $removed &= $this->remove($key);
            }
        }
        $this->array = \array_values($this->array);
        return $removed;
    }
1036391
public function range ($start = 0 , $stop = -1) {
        if ($this->name === null) {
            throw new InvalidConfigException(get_class ($this) . " requires a name!");
        }
        return $this->getConnection ()->getSlave ()->lrange ($this->name , $start , $stop);
    }
152051
function range(start, stop, step) {
  if (start != null && typeof start != 'number') {
    throw new Error('start must be a number or null');
  }
  if (stop != null && typeof stop != 'number') {
    throw new Error('stop must be a number or null');
  }
  if (step != null && typeof step != 'number') {
    throw new Error('step must be a number or null');
  }
  if (stop == null) {
    stop = start || 0;
    start = 0;
  }
  if (step == null) {
    step = stop > start ? 1 : -1;
  }
  var toReturn = [];
  var increasing = start < stop; //← here’s the change
  for (; increasing ? start < stop : start > stop; start += step) {
    toReturn.push(start);
  }
  return toReturn;
}
408425
public function setStep(float $step) : Number
    {
        $this->attributes['step'] = $step;
        $offset = isset($this->attributes['min']) ?
            $this->attributes['min'] :
            0;
        return $this->addTest('step', function ($value) use ($step, $offset) {
            if (!is_numeric($value)) {
                return false;
            }
            return !fmod($value - $offset, $step);
        });
    }
68841
public function insert_range( $index, array $elements ) {
		$this->validate_index( $index );
		$this->type->validate_elements( $elements );

		if ( $index < 0 ) {
			$index = $this->count() + $index + 1;
		}

		return $this->new_from_trusted(
			array_merge(
				array_slice( $this->elements, 0, $index ),
				$elements,
				array_slice( $this->elements, $index, count( $this->elements ) )
			)
		);
	}
775528
public static List<Integer> sequence(final int start, int end, final int step) {

        final int size = (end-start)/step;
        if(size<0)  throw new IllegalArgumentException("List size is negative");

        return new AbstractList<Integer>() {
            public Integer get(int index) {
                if(index<0 || index>=size)
                    throw new IndexOutOfBoundsException();
                return start+index*step;
            }

            public int size() {
                return size;
            }
        };
    }
459027
public function setRange($startIndex, $maxItems)
    {
        $changed = false;
        if (sizeof($this->sorts) == 0) {
            $this->addSort(SolutionSchema::getModelSchema($this->getModelClassName())->uniqueIdentifierColumnName);
        }

        if ($this->rangeStartIndex != $startIndex) {
            $this->rangeStartIndex = $startIndex;
            $changed = true;
        }

        if ($this->rangeEndIndex !== $startIndex + $maxItems - 1) {
            $this->rangeEndIndex = $startIndex + $maxItems - 1;
            $changed = true;
        }

        if ($changed) {
            // Ranges can often be reset to the same values in which case we don't want to invalidate the list
            // as that would cause another query being sent to the database.
            $this->invalidate();
        }

        return $this;
    }