Skip to content

Commit be9aefb

Browse files
committed
fixes
chore: fix lint issues and reorder requires bench: fixes a issue in random number generation
1 parent 8e7ee5f commit be9aefb

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

lib/node_modules/@stdlib/stats/base/dists/triangular/ctor/benchmark/benchmark.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,28 @@
2323
var bench = require( '@stdlib/bench' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2525
var EPS = require( '@stdlib/constants/float64/eps' );
26+
var Float64Array = require( '@stdlib/array/float64' );
27+
var uniform = require( '@stdlib/random/base/uniform' );
2628
var pkg = require( './../package.json' ).name;
2729
var Triangular = require( './../lib' );
28-
var uniform = require( '@stdlib/random/base/uniform' );
29-
var Float64Array = require( '@stdlib/array/float64' );
30+
3031

3132

3233
// MAIN //
3334

3435
bench( pkg+'::instantiation', function benchmark( bm ) {
36+
var as = new Float64Array(bm.iterations);
37+
var bs = new Float64Array(bm.iterations);
38+
var cs = new Float64Array(bm.iterations);
3539
var dist;
3640
var a;
3741
var b;
3842
var c;
3943
var i;
40-
var as = new Float64Array(bm.iterations);
41-
var bs = new Float64Array(bm.iterations);
42-
var cs = new Float64Array(bm.iterations);
43-
for( i = 0; i<bm.iterations; i++){
44-
a = uniform(EPS , 10.0);
45-
b = uniform(a + EPS , a + 10.0);
46-
c = uniform(a , b);
44+
for ( i = 0; i < bm.iterations; i++ ) {
45+
a = uniform(EPS, 10.0);
46+
b = uniform(a + EPS, a + 10.0);
47+
c = uniform(a, b);
4748
as[i] = a;
4849
bs[i] = b;
4950
cs[i] = c;
@@ -110,7 +111,7 @@ bench( pkg+'::set:a', function benchmark( bm ) {
110111

111112
bm.tic();
112113
for ( i = 0; i < bm.iterations; i++ ) {
113-
y = uniform(EPS , 100.0);
114+
y = uniform(EPS, 100.0);
114115
dist.a = y;
115116
if ( dist.a !== y ) {
116117
bm.fail( 'should return set value' );
@@ -167,7 +168,7 @@ bench( pkg+'::set:b', function benchmark( bm ) {
167168

168169
bm.tic();
169170
for ( i = 0; i < bm.iterations; i++ ) {
170-
y = uniform(EPS+c , 100.0+c+EPS);
171+
y = uniform(EPS+c, 100.0+c+EPS);
171172
dist.b = y;
172173
if ( dist.b !== y ) {
173174
bm.fail( 'should return set value' );
@@ -224,7 +225,7 @@ bench( pkg+'::set:c', function benchmark( bm ) {
224225

225226
bm.tic();
226227
for ( i = 0; i < bm.iterations; i++ ) {
227-
y = uniform(a , b);
228+
y = uniform(a, b);
228229
dist.c = y;
229230
if ( dist.c !== y ) {
230231
bm.fail( 'should return set value' );
@@ -253,7 +254,7 @@ bench( pkg+':entropy', function benchmark( bm ) {
253254

254255
bm.tic();
255256
for ( i = 0; i < bm.iterations; i++ ) {
256-
dist.a = uniform(0,c);
257+
dist.a = uniform(0, c);
257258
y = dist.entropy;
258259
if ( isnan( y ) ) {
259260
bm.fail( 'should not return NaN' );
@@ -282,7 +283,7 @@ bench( pkg+':kurtosis', function benchmark( bm ) {
282283

283284
bm.tic();
284285
for ( i = 0; i < bm.iterations; i++ ) {
285-
dist.a = uniform(0.0 , c);
286+
dist.a = uniform(0.0, c);
286287
y = dist.kurtosis;
287288
if ( isnan( y ) ) {
288289
bm.fail( 'should not return NaN' );
@@ -311,7 +312,7 @@ bench( pkg+':mean', function benchmark( bm ) {
311312

312313
bm.tic();
313314
for ( i = 0; i < bm.iterations; i++ ) {
314-
dist.a = uniform(0.0 , c);
315+
dist.a = uniform(0.0, c);
315316
y = dist.mean;
316317
if ( isnan( y ) ) {
317318
bm.fail( 'should not return NaN' );
@@ -340,7 +341,7 @@ bench( pkg+':median', function benchmark( bm ) {
340341

341342
bm.tic();
342343
for ( i = 0; i < bm.iterations; i++ ) {
343-
dist.a = uniform(0.0 , c);
344+
dist.a = uniform(0.0, c);
344345
y = dist.median;
345346
if ( isnan( y ) ) {
346347
bm.fail( 'should not return NaN' );
@@ -369,7 +370,7 @@ bench( pkg+':skewness', function benchmark( bm ) {
369370

370371
bm.tic();
371372
for ( i = 0; i < bm.iterations; i++ ) {
372-
dist.a = uniform(0.0 , c);
373+
dist.a = uniform(0.0, c);
373374
y = dist.skewness;
374375
if ( isnan( y ) ) {
375376
bm.fail( 'should not return NaN' );
@@ -398,7 +399,7 @@ bench( pkg+':stdev', function benchmark( bm ) {
398399

399400
bm.tic();
400401
for ( i = 0; i < bm.iterations; i++ ) {
401-
dist.a = uniform(0.0 , c);
402+
dist.a = uniform(0.0, c);
402403
y = dist.stdev;
403404
if ( isnan( y ) ) {
404405
bm.fail( 'should not return NaN' );
@@ -427,7 +428,7 @@ bench( pkg+':variance', function benchmark( bm ) {
427428

428429
bm.tic();
429430
for ( i = 0; i < bm.iterations; i++ ) {
430-
dist.a = uniform(0.0 , c);
431+
dist.a = uniform(0.0, c);
431432
y = dist.variance;
432433
if ( isnan( y ) ) {
433434
bm.fail( 'should not return NaN' );
@@ -457,7 +458,7 @@ bench( pkg+':cdf', function benchmark( bm ) {
457458

458459
bm.tic();
459460
for ( i = 0; i < bm.iterations; i++ ) {
460-
x = uniform(0.0 , 60.0);
461+
x = uniform(0.0, 60.0);
461462
y = dist.cdf( x );
462463
if ( isnan( y ) ) {
463464
bm.fail( 'should not return NaN' );
@@ -487,7 +488,7 @@ bench( pkg+':mgf', function benchmark( bm ) {
487488

488489
bm.tic();
489490
for ( i = 0; i < bm.iterations; i++ ) {
490-
x = uniform(0.0 , 1.0);
491+
x = uniform(0.0, 1.0);
491492
y = dist.mgf( x );
492493
if ( isnan( y ) ) {
493494
bm.fail( 'should not return NaN' );
@@ -517,7 +518,7 @@ bench( pkg+':pdf', function benchmark( bm ) {
517518

518519
bm.tic();
519520
for ( i = 0; i < bm.iterations; i++ ) {
520-
x = uniform(0.0 , 60.0);
521+
x = uniform(0.0, 60.0);
521522
y = dist.pdf( x );
522523
if ( isnan( y ) ) {
523524
bm.fail( 'should not return NaN' );
@@ -547,7 +548,7 @@ bench( pkg+':quantile', function benchmark( bm ) {
547548

548549
bm.tic();
549550
for ( i = 0; i < bm.iterations; i++ ) {
550-
x = uniform(0.0 , 1.0);
551+
x = uniform(0.0, 1.0);
551552
y = dist.quantile( x );
552553
if ( isnan( y ) ) {
553554
bm.fail( 'should not return NaN' );

lib/node_modules/@stdlib/stats/base/dists/triangular/entropy/benchmark/benchmark.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5555
for ( i = 0; i < len; i++ ) {
5656
min[ i ] = ( uniform(0.0 , 10.0) );
5757
max[ i ] = uniform(min[ i ] + EPS,10.0+min[ i ] + EPS);
58-
mode[ i ] = uniform(min[ i ] + max[ i ]);
58+
mode[ i ] = uniform(min[ i ] , max[ i ]);
5959
}
6060

6161
b.tic();

lib/node_modules/@stdlib/stats/base/dists/triangular/pdf/benchmark/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
var bench = require( '@stdlib/bench' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2525
var Float64Array = require( '@stdlib/array/float64' );
26-
var uniform = require( '@stdlib/random/base/uniform' );
2726
var EPS = require( '@stdlib/constants/float64/eps' );
27+
var uniform = require( '@stdlib/random/base/uniform' );
2828
var pkg = require( './../package.json' ).name;
2929
var pdf = require( './../lib' );
3030

0 commit comments

Comments
 (0)