Skip to content

Commit c940278

Browse files
committed
Refactor random number generation in JS benchmarks
--- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 168fc43 commit c940278

File tree

7 files changed

+87
-88
lines changed

7 files changed

+87
-88
lines changed

lib/node_modules/@stdlib/stats/base/dists/planck/variance/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ for ( i = 0; i < lambda.length; i++ ) {
148148

149149
#### stdlib_base_dists_planck_variance( lambda )
150150

151-
Evaluates the variance for an planck distribution.
151+
Returns the variance for planck distribution with shape parameter `λ`.
152152

153153
```c
154154
double out = stdlib_base_dists_planck_variance( 0.1 );

lib/node_modules/@stdlib/stats/base/dists/planck/variance/benchmark/benchmark.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var Float64Array = require( '@stdlib/array/float64' );
25-
var randu = require( '@stdlib/random/base/randu' );
25+
var uniform = require( '@stdlib/random/base/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var pkg = require( './../package.json' ).name;
2828
var variance = require( './../lib' );
@@ -39,7 +39,7 @@ bench( pkg, function benchmark( b ) {
3939
len =100;
4040
lambda = new Float64Array( len );
4141
for ( i = 0; i < len; i++ ) {
42-
lambda[ i ] = ( randu() * 10.0 ) + 1.0;
42+
lambda[ i ] = uniform( 1.0, 10.0 );
4343
}
4444

4545
b.tic();

lib/node_modules/@stdlib/stats/base/dists/planck/variance/benchmark/benchmark.native.js

Lines changed: 2 additions & 2 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 pkg = require( './../package.json' ).name;
@@ -48,7 +48,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4848
len =100;
4949
lambda = new Float64Array( len );
5050
for ( i = 0; i < len; i++ ) {
51-
lambda[ i ] = ( randu() * 10.0 ) + 1.0;
51+
lambda[ i ] = uniform( 1.0, 10.0 );
5252
}
5353

5454
b.tic();

lib/node_modules/@stdlib/stats/base/dists/planck/variance/include/stdlib/stats/base/dists/planck/variance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
* Evaluates the variance for an planck distribution with shape parameter lambda.
30+
*Returns the variance for planck distribution with shape parameter `λ`.
3131
*/
3232
double stdlib_base_dists_planck_variance( const double lambda );
3333

lib/node_modules/@stdlib/stats/base/dists/planck/variance/lib/native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var addon = require( './../src/addon.node' );
2626
// MAIN //
2727

2828
/**
29-
* Evaluates the variance for a Planck distribution with shape parameter `λ`.
29+
*Returns the variance for planck distribution with shape parameter `λ`.
3030
*
3131
* @private
3232
* @param {number} lambda - shape parameter
Lines changed: 79 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,82 @@
1-
21
{
3-
"options": {
2+
"options": {
3+
"task": "build",
4+
"wasm": false
5+
},
6+
"fields": [
7+
{
8+
"field": "src",
9+
"resolve": true,
10+
"relative": true
11+
},
12+
{
13+
"field": "include",
14+
"resolve": true,
15+
"relative": true
16+
},
17+
{
18+
"field": "libraries",
19+
"resolve": false,
20+
"relative": false
21+
},
22+
{
23+
"field": "libpath",
24+
"resolve": true,
25+
"relative": false
26+
}
27+
],
28+
"confs": [
29+
{
430
"task": "build",
5-
"wasm": false
31+
"wasm": false,
32+
"src": [
33+
"./src/main.c"
34+
],
35+
"include": [
36+
"./include"
37+
],
38+
"libraries": [],
39+
"libpath": [],
40+
"dependencies": [
41+
"@stdlib/math/base/napi/unary",
42+
"@stdlib/math/base/assert/is-nan",
43+
"@stdlib/math/base/special/exp",
44+
"@stdlib/math/base/special/expm1"
45+
]
46+
},
47+
{
48+
"task": "benchmark",
49+
"wasm": false,
50+
"src": [
51+
"./src/main.c"
52+
],
53+
"include": [
54+
"./include"
55+
],
56+
"libraries": [],
57+
"libpath": [],
58+
"dependencies": [
59+
"@stdlib/math/base/assert/is-nan",
60+
"@stdlib/math/base/special/exp",
61+
"@stdlib/math/base/special/expm1"
62+
]
663
},
7-
"fields": [
8-
{
9-
"field": "src",
10-
"resolve": true,
11-
"relative": true
12-
},
13-
{
14-
"field": "include",
15-
"resolve": true,
16-
"relative": true
17-
},
18-
{
19-
"field": "libraries",
20-
"resolve": false,
21-
"relative": false
22-
},
23-
{
24-
"field": "libpath",
25-
"resolve": true,
26-
"relative": false
27-
}
28-
],
29-
"confs": [
30-
{
31-
"task": "build",
32-
"wasm": false,
33-
"src": [
34-
"./src/main.c"
35-
],
36-
"include": [
37-
"./include"
38-
],
39-
"libraries": [],
40-
"libpath": [],
41-
"dependencies": [
42-
"@stdlib/math/base/napi/unary",
43-
"@stdlib/math/base/assert/is-nan",
44-
"@stdlib/math/base/special/exp",
45-
"@stdlib/math/base/special/expm1"
46-
]
47-
},
48-
{
49-
"task": "benchmark",
50-
"wasm": false,
51-
"src": [
52-
"./src/main.c"
53-
],
54-
"include": [
55-
"./include"
56-
],
57-
"libraries": [],
58-
"libpath": [],
59-
"dependencies": [
60-
"@stdlib/math/base/assert/is-nan",
61-
"@stdlib/math/base/special/exp",
62-
"@stdlib/math/base/special/expm1"
63-
]
64-
},
65-
{
66-
"task": "examples",
67-
"wasm": false,
68-
"src": [
69-
"./src/main.c"
70-
],
71-
"include": [
72-
"./include"
73-
],
74-
"libraries": [],
75-
"libpath": [],
76-
"dependencies": [
77-
"@stdlib/math/base/assert/is-nan",
78-
"@stdlib/math/base/special/exp",
79-
"@stdlib/math/base/special/expm1"
80-
]
81-
}
82-
]
83-
}
64+
{
65+
"task": "examples",
66+
"wasm": false,
67+
"src": [
68+
"./src/main.c"
69+
],
70+
"include": [
71+
"./include"
72+
],
73+
"libraries": [],
74+
"libpath": [],
75+
"dependencies": [
76+
"@stdlib/math/base/assert/is-nan",
77+
"@stdlib/math/base/special/exp",
78+
"@stdlib/math/base/special/expm1"
79+
]
80+
}
81+
]
82+
}

lib/node_modules/@stdlib/stats/base/dists/planck/variance/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "stdlib/math/base/special/expm1.h"
2323

2424
/**
25-
* Evaluates the variance of a Planck distribution for a given shape parameter `lambda`.
25+
*Returns the variance for planck distribution with shape parameter `λ`.
2626
*
2727
* @param lambda shape parameter
2828
* @return variance

0 commit comments

Comments
 (0)