# mlx.core.arange — MLX 0.0.7 documentation

Skip to main content
`Ctrl`+`K`

# mlx.core.arange

mlx.core.arange(start, stop, step, dtype: Optional[ Dtype ] = None, *, stream: Union[ None , Stream , Device ] = None) → array

  Generates ranges of numbers.

  Generate numbers in the half-open interval `[start, stop)` in increments of `step`.

  Parameters:

    - start (float or int , optional) – Starting value which defaults to `0`.

    - stop (float or int) – Stopping value.

    - step (float or int , optional) – Increment which defaults to `1`.

    - dtype (Dtype , optional) – Specifies the data type of the output. If unspecified will default to `float32` if any of `start`, `stop`, or `step` are `float`. Otherwise will default to `int32`.

  Returns:

    The range of values.

  Return type:

    array

  Note

  Following the Numpy convention the actual increment used to generate numbers is `dtype(start + step) - dtype(start)`. This can lead to unexpected results for example if start + step is a fractional value and the dtype is integral.