Skip to content

Commit 2d2a73f

Browse files
authored
chore: apply suggestions from code review
Signed-off-by: Philipp Burckhardt <[email protected]>
1 parent 5ab3497 commit 2d2a73f

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

lib/node_modules/@stdlib/stats/base/dists/normal/logpdf/benchmark/benchmark.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ bench( pkg, function benchmark( b ) {
4545
mu = new Float64Array( len );
4646
sigma = new Float64Array( len );
4747
for ( i = 0; i < len; i++ ) {
48-
x[ i ] = ( randu() * 200.0 ) - 100.0;
49-
mu[ i ] = ( randu() * 100.0 ) - 50.0;
50-
sigma[ i ] = ( randu() * 20.0 ) + EPS;
48+
x[ i ] = uniform( -100.0, 100.0 );
49+
mu[ i ] = uniform( -50.0, 50.0 );
50+
sigma[ i ] = uniform( EPS, 20.0 );
5151
}
5252

5353
b.tic();

lib/node_modules/@stdlib/stats/base/dists/normal/logpdf/benchmark/benchmark.native.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
2525
var Float64Array = require( '@stdlib/array/float64' );
26-
var randu = require( '@stdlib/random/base/randu' );
26+
var uniform = require( '@stdlib/random/base/uniform' );
2727
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2828
var tryRequire = require( '@stdlib/utils/try-require' );
2929
var EPS = require( '@stdlib/constants/float64/eps' );
@@ -53,9 +53,9 @@ bench( pkg, opts, function benchmark( b ) {
5353
mu = new Float64Array( len );
5454
sigma = new Float64Array( len );
5555
for ( i = 0; i < len; i++ ) {
56-
x[ i ] = ( randu() * 200.0 ) - 100.0;
57-
mu[ i ] = ( randu() * 100.0 ) - 50.0;
58-
sigma[ i ] = ( randu() * 20.0 ) + EPS;
56+
x[ i ] = uniform( -100.0, 100.0 );
57+
mu[ i ] = uniform( -50.0, 50.0 );
58+
sigma[ i ] = uniform( EPS, 20.0 );
5959
}
6060

6161
b.tic();

lib/node_modules/@stdlib/stats/base/dists/normal/logpdf/examples/c/example.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@
2222
#include <time.h>
2323

2424
static double random_uniform( const double min, const double max ) {
25-
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
26-
return min + ( v*(max-min) );
25+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
26+
return min + ( v*(max-min) );
2727
}
2828

2929
int main( void ) {
30-
double x;
31-
double mu;
32-
double sigma;
33-
double y;
34-
int i;
30+
double sigma;
31+
double mu;
32+
double x;
33+
double y;
34+
int i;
3535

36-
for ( i = 0; i < 10; i++ ) {
37-
x = random_uniform( 0.0, 10.0 );
38-
mu = random_uniform( -5.0, 5.0 );
39-
sigma = random_uniform( 0.0, 20.0 );
40-
y = stdlib_base_dists_normal_logpdf( x, mu, sigma );
41-
printf( "x: %lf, µ: %lf, σ: %lf, ln(f(x;µ,σ)): %lf\n", x, mu, sigma, y );
42-
}
36+
for ( i = 0; i < 10; i++ ) {
37+
x = random_uniform( 0.0, 10.0 );
38+
mu = random_uniform( -5.0, 5.0 );
39+
sigma = random_uniform( 0.0, 20.0 );
40+
y = stdlib_base_dists_normal_logpdf( x, mu, sigma );
41+
printf( "x: %lf, µ: %lf, σ: %lf, ln(f(x;µ,σ)): %lf\n", x, mu, sigma, y );
42+
}
4343
}

0 commit comments

Comments
 (0)