Skip to content

Commit bbeefcd

Browse files
chore: update factory code block
1 parent 17db639 commit bbeefcd

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lib/node_modules/@stdlib/stats/base/dists/bernoulli/cdf/benchmark/benchmark.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bench( pkg, function benchmark( b ) {
4141
len = 100;
4242
x = new Float64Array( len );
4343
for ( i = 0; i < len; i++ ) {
44-
x[ i ] = uniform( 2.0, 3.0 );
44+
x[ i ] = uniform( -1.0, 2.0 );
4545
}
4646
p = new Float64Array( len );
4747
for ( i = 0; i < len; i++ ) {
@@ -65,6 +65,7 @@ bench( pkg, function benchmark( b ) {
6565

6666
bench( pkg+':factory', function benchmark( b ) {
6767
var mycdf;
68+
var len;
6869
var p;
6970
var x;
7071
var y;
@@ -73,10 +74,14 @@ bench( pkg+':factory', function benchmark( b ) {
7374
p = 0.3;
7475
mycdf = cdf.factory( p );
7576

77+
x = new Float64Array( len );
78+
for ( i = 0; i < len; i++ ) {
79+
x[ i ] = uniform( -1.0, 2.0 );
80+
}
81+
7682
b.tic();
7783
for ( i = 0; i < b.iterations; i++ ) {
78-
x = ( randu()*3.0 ) - 1.0;
79-
y = mycdf( x );
84+
y = mycdf( x[ i%100 ] );
8085
if ( isnan( y ) ) {
8186
b.fail( 'should not return NaN' );
8287
}

lib/node_modules/@stdlib/stats/base/dists/bernoulli/cdf/benchmark/c/benchmark.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ static double benchmark( void ) {
100100
int i;
101101

102102
for ( i = 0; i < 100; i++ ) {
103-
p[ i ] = random_uniform( 0.1, 10.0 );
103+
p[ i ] = random_uniform( 0.0, 1.0 );
104104
}
105105
for ( i = 0; i < 100; i++ ) {
106-
x[ i ] = random_uniform( 2.0, 3.0 );
106+
x[ i ] = random_uniform( -1.0, 2.0 );
107107
}
108108

109109
t = tic();

0 commit comments

Comments
 (0)