Skip to content

Commit e6db548

Browse files
committed
refactor: update levy median implementation
1 parent 3c63b7b commit e6db548

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

lib/node_modules/@stdlib/stats/base/dists/levy/median/benchmark/benchmark.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var EPS = require( '@stdlib/constants/float64/eps' );
2828
var pkg = require( './../package.json' ).name;
2929
var median = require( './../lib' );
30+
var uniform = require('@stdlib/random/base/uniform');
3031

3132

3233
// MAIN //
@@ -42,8 +43,8 @@ bench( pkg, function benchmark( b ) {
4243
mu = new Float64Array( len );
4344
c = new Float64Array( len );
4445
for ( i = 0; i < len; i++ ) {
45-
mu[ i ] = ( randu() * 100.0 ) - 50.0;
46-
c[ i ] = ( randu() * 20.0 ) + EPS;
46+
mu[ i ] = uniform( -50.0, 50.0 );
47+
c[ i ] = uniform( EPS, 20.0 + EPS );
4748
}
4849

4950
b.tic();

lib/node_modules/@stdlib/stats/base/dists/levy/median/benchmark/benchmark.native.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var randu = require( '@stdlib/random/base/randu' );
2828
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2929
var tryRequire = require( '@stdlib/utils/try-require' );
3030
var pkg = require( './../package.json' ).name;
31+
var uniform = require('@stdlib/random/base/uniform');
3132

3233

3334
// VARIABLES //
@@ -51,8 +52,8 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5152
mu = new Float64Array( len );
5253
c = new Float64Array( len );
5354
for ( i = 0; i < len; i++ ) {
54-
mu[ i ] = ( randu() * 100.0 ) - 50.0;
55-
c[ i ] = ( randu() * 20.0 ) + EPS;
55+
mu[ i ] = uniform( -50.0, 50.0 );
56+
c[ i ] = uniform( EPS, 20.0 + EPS );
5657
}
5758

5859
b.tic();

lib/node_modules/@stdlib/stats/base/dists/levy/median/test/test.native.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ tape( 'main export is a function', opts, function test( t ) {
5353

5454
tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) {
5555
var y = median( NaN, 1.0 );
56-
t.equal( isnan( y ), true, 'returns NaN' );
56+
t.equal( isnan( y ), true, 'returns expected value' );
5757
y = median( 1.0, NaN );
58-
t.equal( isnan( y ), true, 'returns NaN' );
58+
t.equal( isnan( y ), true, 'returns expected value' );
5959
t.end();
6060
});
6161

0 commit comments

Comments
 (0)