@stdlib/array
Version:
Arrays.
57 lines (41 loc) • 1.12 kB
Plain Text
{{alias}}( n )
Generates a linearly spaced numeric array whose elements increment by 1
starting from zero.
If `n` is a non-integer value greater than zero, the function returns an
array having `ceil(n)` elements.
If `n` is less than or equal to zero, the function returns an empty array.
Parameters
----------
n: number
Number of elements.
Returns
-------
out: Array
Linearly spaced numeric array.
Examples
--------
> var arr = {{alias}}( 6 )
[ 0, 1, 2, 3, 4, 5 ]
{{alias}}.assign( out, stride, offset )
Fills an array with linearly spaced numeric elements which increment by 1
starting from zero.
Parameters
----------
out: ArrayLikeObject
Output array.
stride: integer
Output array stride.
offset: integer
Output array index offset.
Returns
-------
out: ArrayLikeObject
Output array.
Examples
--------
> var out = [ 0, 0, 0, 0, 0, 0 ];
> {{alias}}.assign( out, -1, out.length-1 );
> out
[ 5, 4, 3, 2, 1, 0 ]
See Also
--------