Skip to content

Commit 09c397b

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 eb8f60c commit 09c397b

File tree

7 files changed

+95
-100
lines changed

7 files changed

+95
-100
lines changed

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

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

152152
#### stdlib_base_dists_planck_pmf( x, lambda )
153153

154-
Returns a function for evaluating the probability mass function(pmf) of a Planck distribution with shape parameter `lambda`.
154+
Evaluates the probability mass function(pmf) of a Planck distribution with shape parameter `lambda`.
155155

156156
```c
157157
double out = stdlib_base_dists_planck_pmf( 4.0 , 3.0 );

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var Float64Array = require( '@stdlib/array/float64' );
25-
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
26-
var discreteUniformBase = require( '@stdlib/random/base/discrete-uniform' );
27-
var uniformBase = require( '@stdlib/random/base/uniform' );
25+
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
26+
var uniform = require( '@stdlib/random/base/uniform' );
2827
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2928
var pkg = require( './../package.json' ).name;
3029
var pmf = require( './../lib' );
@@ -43,8 +42,8 @@ bench( pkg, function benchmark( b ) {
4342
x = new Float64Array( len );
4443
lambda = new Float64Array( len );
4544
for ( i = 0; i < len; i++ ) {
46-
x[i] = discreteUniformBase(0, 40);
47-
lambda[i] = uniformBase(1.0, 11.0);
45+
x[i] = discreteUniform(0, 40);
46+
lambda[i] = uniform(1.0, 11.0);
4847
}
4948

5049
b.tic();
@@ -68,7 +67,7 @@ bench( pkg+':factory', function benchmark( b ) {
6867
var y;
6968
var i;
7069

71-
x = discreteUniform( 100, 0, 40 );
70+
x = discreteUniform( 0, 40 );
7271
mypmf = pmf.factory( 0.3 );
7372

7473
b.tic();

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
2525
var Float64Array = require( '@stdlib/array/float64' );
26-
var discreteUniformBase = require( '@stdlib/random/base/discrete-uniform' );
27-
var uniformBase = require( '@stdlib/random/base/uniform' );
26+
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
27+
var uniform = require( '@stdlib/random/base/uniform' );
2828
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2929
var tryRequire = require( '@stdlib/utils/try-require' );
3030
var pkg = require( './../package.json' ).name;
@@ -51,8 +51,8 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5151
x = new Float64Array( len );
5252
lambda = new Float64Array( len );
5353
for ( i = 0; i < len; i++ ) {
54-
x[i] = discreteUniformBase(0, 40);
55-
lambda[i] = uniformBase(1.0, 11.0);
54+
x[i] = discreteUniform(0, 40);
55+
lambda[i] = uniform(1.0, 11.0);
5656
}
5757

5858
b.tic();

lib/node_modules/@stdlib/stats/base/dists/planck/pmf/include/stdlib/stats/base/dists/planck/pmf.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 pmf for an planck distribution.
30+
*Evaluates the probability mass function(pmf) of a Planck distribution with shape parameter `lambda`.
3131
*/
3232
double stdlib_base_dists_planck_pmf( const double x, const double lambda );
3333

lib/node_modules/@stdlib/stats/base/dists/planck/pmf/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 probability mass function (PMF) for a Planck (discrete exponential) distribution with shape parameter `lambda` at a value `x`.
29+
* Evaluates the probability mass function (PMF) for a Planck (discrete exponential) distribution with shape parameter `lambda` .
3030
*
3131
* @private
3232
* @param {number} x - input value (integer)
Lines changed: 82 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,85 @@
11
{
2-
"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+
{
330
"task": "build",
4-
"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/binary",
42+
"@stdlib/math/base/assert/is-nan",
43+
"@stdlib/math/base/assert/is-nonnegative-integer",
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/assert/is-nonnegative-integer",
62+
"@stdlib/math/base/special/exp",
63+
"@stdlib/math/base/special/expm1"
64+
]
565
},
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-
{
30-
"task": "build",
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/binary",
42-
"@stdlib/math/base/assert/is-nan",
43-
"@stdlib/math/base/assert/is-nonnegative-integer",
44-
"@stdlib/math/base/special/exp",
45-
"@stdlib/math/base/special/expm1",
46-
"@stdlib/constants/float64/pi"
47-
48-
]
49-
},
50-
{
51-
"task": "benchmark",
52-
"wasm": false,
53-
"src": [
54-
"./src/main.c"
55-
],
56-
"include": [
57-
"./include"
58-
],
59-
"libraries": [],
60-
"libpath": [],
61-
"dependencies": [
62-
"@stdlib/math/base/assert/is-nan",
63-
"@stdlib/math/base/assert/is-nonnegative-integer",
64-
"@stdlib/math/base/special/exp",
65-
"@stdlib/math/base/special/expm1",
66-
"@stdlib/constants/float64/pi"
67-
]
68-
},
69-
{
70-
"task": "examples",
71-
"wasm": false,
72-
"src": [
73-
"./src/main.c"
74-
],
75-
"include": [
76-
"./include"
77-
],
78-
"libraries": [],
79-
"libpath": [],
80-
"dependencies": [
81-
"@stdlib/math/base/assert/is-nan",
82-
"@stdlib/math/base/assert/is-nonnegative-integer",
83-
"@stdlib/math/base/special/exp",
84-
"@stdlib/math/base/special/expm1",
85-
"@stdlib/constants/float64/pi"
86-
]
87-
}
88-
]
89-
}
66+
{
67+
"task": "examples",
68+
"wasm": false,
69+
"src": [
70+
"./src/main.c"
71+
],
72+
"include": [
73+
"./include"
74+
],
75+
"libraries": [],
76+
"libpath": [],
77+
"dependencies": [
78+
"@stdlib/math/base/assert/is-nan",
79+
"@stdlib/math/base/assert/is-nonnegative-integer",
80+
"@stdlib/math/base/special/exp",
81+
"@stdlib/math/base/special/expm1"
82+
]
83+
}
84+
]
85+
}

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

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

2525
/**
26-
* Evaluates the probability mass function (PMF) for a Planck distribution with shape parameter `lambda` at a value `x`.
26+
* Evaluates the probability mass function (PMF) for a Planck distribution with shape parameter `lambda`.
2727
*
2828
* @param x input value
2929
* @param lambda shape parameter (must be positive)

0 commit comments

Comments
 (0)