Skip to content

Latest commit

 

History

History
107 lines (63 loc) · 1.94 KB

File metadata and controls

107 lines (63 loc) · 1.94 KB

range

Calculate the range of an array.

Usage

var range = require( '@stdlib/stats/array/range' );

range( x )

Computes the range of an array.

var x = [ 1.0, -2.0, 2.0 ];

var v = range( x );
// returns 4.0

The function has the following parameters:

  • x: input array.

Notes

  • If provided an empty array, the function returns NaN.

Examples

var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var range = require( '@stdlib/stats/array/range' );

var x = discreteUniform( 10, -50, 50, {
    'dtype': 'float64'
});
console.log( x );

var v = range( x );
console.log( v );