Skip to content

Commit 7bec13d

Browse files
Refactor benchmark and test files to use fixtures and consistent RNG. Fixes #5902
1 parent 099dca8 commit 7bec13d

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,5 @@ tape( 'the function returns the median of a Cauchy distribution', opts, function
9595
t.equal( y, expected[i], 'x0 :'+x0[i]+', gamma: '+gamma[i]+', y: '+y+', expected: '+expected[i] );
9696
}
9797
t.end();
98+
9899
});

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,21 @@ bench( pkg, function benchmark( b ) {
3535
var len;
3636
var mu;
3737
var c;
38+
var rand1;
39+
var rand2;
3840
var y;
3941
var i;
4042

4143
len = 100;
4244
mu = new Float64Array( len );
4345
c = new Float64Array( len );
46+
47+
rand1 = uniform( -50.0, 50.0 );
48+
rand2 = uniform( EPS, 20.0 + EPS );
49+
4450
for ( i = 0; i < len; i++ ) {
45-
mu[ i ] = uniform( -50.0, 50.0 );
46-
c[ i ] = uniform( EPS, 20.0 + EPS );
51+
mu[ i ] = rand1();
52+
c[ i ] = rand2();
4753
}
4854

4955
b.tic();
@@ -60,3 +66,4 @@ bench( pkg, function benchmark( b ) {
6066
b.pass( 'benchmark finished' );
6167
b.end();
6268
});
69+

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,21 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4444
var len;
4545
var mu;
4646
var c;
47+
var rand1;
48+
var rand2;
4749
var y;
4850
var i;
4951

5052
len = 100;
5153
mu = new Float64Array( len );
5254
c = new Float64Array( len );
55+
56+
rand1 = uniform( -50.0, 50.0 );
57+
rand2 = uniform( EPS, 20.0 + EPS );
58+
5359
for ( i = 0; i < len; i++ ) {
54-
mu[ i ] = uniform( -50.0, 50.0 );
55-
c[ i ] = uniform( EPS, 20.0 + EPS );
60+
mu[ i ] = rand1();
61+
c[ i ] = rand2();
5662
}
5763

5864
b.tic();
@@ -69,3 +75,4 @@ bench( pkg+'::native', opts, function benchmark( b ) {
6975
b.pass( 'benchmark finished' );
7076
b.end();
7177
});
78+

0 commit comments

Comments
 (0)