Skip to content

Commit 5223b20

Browse files
chore: updated random generation function
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 8a85750 commit 5223b20

File tree

7 files changed

+10
-44
lines changed

7 files changed

+10
-44
lines changed

lib/node_modules/@stdlib/stats/base/dists/triangular/logpdf/README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ y = mylogpdf( 12.0 );
134134
<!-- eslint no-undef: "error" -->
135135

136136
```javascript
137-
var randu = require( '@stdlib/random/base/randu' );
137+
var uniform = require( '@stdlib/random/base/uniform' );
138138
var logpdf = require( '@stdlib/stats/base/dists/triangular/logpdf' );
139139

140140
var a;
@@ -145,10 +145,10 @@ var y;
145145
var i;
146146

147147
for ( i = 0; i < 25; i++ ) {
148-
x = randu() * 30.0;
149-
a = randu() * 10.0;
150-
b = a + (randu() * 40.0);
151-
c = a + ((b-a) * randu());
148+
x = uniform( 0.0, 30.0 );
149+
a = uniform( 0.0, 10.0 );
150+
b = a + ( uniform( 0.0, 40.0 ) );
151+
c = uniform( a, b );
152152
y = logpdf( x, a, b, c );
153153
console.log( 'x: %d, a: %d, b: %d, c: %d, ln(f(x;a,b,c)): %d', x.toFixed( 4 ), a.toFixed( 4 ), b.toFixed( 4 ), c.toFixed( 4 ), y.toFixed( 4 ) );
154154
}
@@ -190,11 +190,7 @@ for ( i = 0; i < 25; i++ ) {
190190

191191
#### stdlib_base_dists_triangular_logpdf( x, a, b, c )
192192

193-
<<<<<<< HEAD
194-
Evaluates the natural logarithm of the [probability density function][pdf] (PDF) for a [triangular][triangular-distribution] distribution with parameters `a` (lower limit), `b` (upper limit) and `c` (mode).
195-
=======
196193
Evaluates the natural logarithm of the [probability density function][pdf] (PDF) for a [triangular][triangular-distribution] distribution with parameters `a` (lower limit), `b` (upper limit), and `c` (mode).
197-
>>>>>>> develop
198194

199195
```c
200196
double y = stdlib_base_dists_triangular_logpdf( 0.5, -1.0, 1.0, 0.0 );
@@ -254,11 +250,7 @@ int main( void ) {
254250
x = random_uniform( 0.0, 30.0 );
255251
a = random_uniform( 0.0, 10.0 );
256252
b = random_uniform( a + STDLIB_CONSTANT_FLOAT64_EPS, 40.0 );
257-
<<<<<<< HEAD
258-
c = a + random_uniform( 0.0, b - a );
259-
=======
260253
c = random_uniform( a, b );
261-
>>>>>>> develop
262254
y = stdlib_base_dists_triangular_logpdf( x, a, b, c );
263255
printf( "x: %lf, a: %lf, b: %lf, c: %lf, ln(f(x;a,b,c)): %lf\n", x, a, b, c, y );
264256
}

lib/node_modules/@stdlib/stats/base/dists/triangular/logpdf/benchmark/c/benchmark.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,7 @@ static double benchmark( void ) {
106106
x[ i ] = random_uniform( 0.0, 30.0 );
107107
a[ i ] = random_uniform( 0.0, 10.0 );
108108
b[ i ] = random_uniform( a[ i ] + STDLIB_CONSTANT_FLOAT64_EPS, 40.0 );
109-
<<<<<<< HEAD
110-
c[ i ] = a[ i ] + random_uniform( 0.0, b[ i ] - a[ i ] );
111-
=======
112109
c[ i ] = random_uniform( a[ i ], b[ i ] );
113-
>>>>>>> develop
114110
}
115111

116112
t = tic();

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,8 @@ int main( void ) {
3838
for ( i = 0; i < 25; i++ ) {
3939
x = random_uniform( 0.0, 30.0 );
4040
a = random_uniform( 0.0, 10.0 );
41-
<<<<<<< HEAD
42-
b = random_uniform( a, 40.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
43-
c = a + random_uniform( 0.0, b - a );
44-
=======
4541
b = random_uniform( a + STDLIB_CONSTANT_FLOAT64_EPS, 40.0 );
4642
c = random_uniform( a, b );
47-
>>>>>>> develop
4843
y = stdlib_base_dists_triangular_logpdf( x, a, b, c );
4944
printf( "x: %lf, a: %lf, b: %lf, c: %lf, ln(f(x;a,b,c)): %lf\n", x, a, b, c, y );
5045
}

lib/node_modules/@stdlib/stats/base/dists/triangular/logpdf/examples/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random/base/randu' );
21+
var uniform = require( '@stdlib/random/base/uniform' );
2222
var logpdf = require( './../lib' );
2323

2424
var a;
@@ -29,10 +29,10 @@ var y;
2929
var i;
3030

3131
for ( i = 0; i < 25; i++ ) {
32-
x = randu() * 30.0;
33-
a = randu() * 10.0;
34-
b = a + (randu() * 40.0);
35-
c = a + ((b-a) * randu());
32+
x = uniform( 0.0, 30.0 );
33+
a = uniform( 0.0, 10.0 );
34+
b = a + ( uniform( 0.0, 40.0 ) );
35+
c = uniform( a, b );
3636
y = logpdf( x, a, b, c );
3737
console.log( 'x: %d, a: %d, b: %d, c: %d, ln(f(x;a,b,c)): %d', x.toFixed( 4 ), a.toFixed( 4 ), b.toFixed( 4 ), c.toFixed( 4 ), y.toFixed( 4 ) );
3838
}

lib/node_modules/@stdlib/stats/base/dists/triangular/logpdf/include/stdlib/stats/base/dists/triangular/logpdf.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
<<<<<<< HEAD
31-
* Evaluates the natural logarithm of the probability density function (PDF) for a triangular distribution with lower limit `a` and upper limit `b` and mode `c` at a value `x`.
32-
=======
3330
* Evaluates the natural logarithm of the probability density function (PDF) for a triangular distribution with lower limit `a`, upper limit `b`, and mode `c` at a value `x`.
34-
>>>>>>> develop
3531
*/
3632
double stdlib_base_dists_triangular_logpdf( const double x, const double a, const double b, const double c );
3733

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ var addon = require( './../src/addon.node' );
2626
// MAIN //
2727

2828
/**
29-
<<<<<<< HEAD
30-
* Evaluates the natural logarithm of the probability density function (PDF) for a triangular distribution with lower limit `a` and upper limit `b` and mode `c` at a value `x`.
31-
=======
3229
* Evaluates the natural logarithm of the probability density function (PDF) for a triangular distribution with lower limit `a`, upper limit `b`, and mode `c` at a value `x`.
33-
>>>>>>> develop
3430
*
3531
* @private
3632
* @param {number} x - input value

lib/node_modules/@stdlib/stats/base/dists/triangular/logpdf/src/main.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@
2323
#include "stdlib/math/base/special/ln.h"
2424

2525
/**
26-
<<<<<<< HEAD
27-
* Evaluates the natural logarithm of the probability density function (PDF) for a triangular distribution
28-
* with parameters `a`, `b`, and `c` at a value `x`.
29-
=======
3026
* Evaluates the natural logarithm of the probability density function (PDF) for a triangular distribution with lower limit `a`, upper limit `b`, and mode `c` at a value `x`.
31-
>>>>>>> develop
3227
*
3328
* @param x input value
3429
* @param a lower limit
@@ -37,11 +32,7 @@
3732
* @return evaluated logPDF
3833
*
3934
* @example
40-
<<<<<<< HEAD
41-
* double y = stdlib_base_dists_geometric_logpdf( 0.5, -1.0, 1.0, 0.0 );
42-
=======
4335
* double y = stdlib_base_dists_triangular_logpdf( 0.5, -1.0, 1.0, 0.0 );
44-
>>>>>>> develop
4536
* // returns ~-0.693
4637
*/
4738
double stdlib_base_dists_triangular_logpdf( const double x, const double a, const double b, const double c ) {

0 commit comments

Comments
 (0)