Skip to content

Commit 2a2a5dd

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

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

lib/node_modules/@stdlib/stats/base/dists/negative-binomial/mode/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ for ( i = 0; i < 10; i++ ) {
170170
Returns the mode of a negative binomial distribution.
171171

172172
```c
173-
double y = stdlib_base_negative_binomial_mode( 100.0, 0.2 );
173+
double y = stdlib_base_dists_negative_binomial_mode( 100.0, 0.2 );
174174
// returns 396.0
175175
```
176176

177177
The function accepts the following arguments:
178178

179-
- **r**: `[in] double` number of failures until experiment is stopped .
180-
- **p**: `[in] double` success probability .
179+
- **r**: `[in] double` number of failures until experiment is stopped.
180+
- **p**: `[in] double` success probability.
181181

182182
```c
183183
double stdlib_base_dists_negative_binomial_mode( const double r, const double p );
@@ -218,10 +218,10 @@ int main( void ) {
218218
int i;
219219
220220
for ( i = 0; i < 10; i++ ) {
221-
r = random_uniform(1.0, 100.0);
222-
p = random_uniform(0.01, 0.99);
221+
r = random_uniform( 1.0, 100.0 );
222+
p = random_uniform( 0.01, 0.99 );
223223
y = stdlib_base_dists_negative_binomial_mode( r, p );
224-
printf("r: %f, p: %.4f, mode(X; r, p): %.4f\n", r, p, y);
224+
printf( "r: %f, p: %.4f, mode(X;r,p): %.4f\n", r, p, y );
225225
}
226226
}
227227
```

lib/node_modules/@stdlib/stats/base/dists/negative-binomial/mode/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 ceil = require( '@stdlib/math/base/special/ceil' );
27-
var randu = require( '@stdlib/random/base/randu' );
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 EPS = require( '@stdlib/constants/float64/eps' );
@@ -52,8 +52,8 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5252
r = new Float64Array( len );
5353
p = new Float64Array( len );
5454
for ( i = 0; i < len; i++ ) {
55-
r[ i ] = ceil( randu() * 100.0 );
56-
p[ i ] = ( randu() * 1.0 ) + EPS;
55+
r[ i ] = discreteUniform( 1, 100 );
56+
p[ i ] = uniform( EPS, 1.0 );
5757
}
5858
b.tic();
5959
for ( i = 0; i < b.iterations; i++ ) {

lib/node_modules/@stdlib/stats/base/dists/negative-binomial/mode/examples/c/example.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ int main( void ) {
3232
int i;
3333

3434
for ( i = 0; i < 10; i++ ) {
35-
r = random_uniform(1.0, 100.0);
36-
p = random_uniform(0.01, 0.99);
35+
r = random_uniform( 1.0, 100.0 );
36+
p = random_uniform( 0.01, 0.99 );
3737
y = stdlib_base_dists_negative_binomial_mode( r, p );
38-
printf("r: %f, p: %.4f, mode(X; r, p): %.4f\n", r, p, y);
38+
printf( "r: %f, p: %.4f, mode(X;r,p): %.4f\n", r, p, y );
3939
}
4040
}

lib/node_modules/@stdlib/stats/base/dists/negative-binomial/mode/src/main.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
/**
2424
* Returns the mode of a negative binomial distribution.
2525
*
26-
* @param r number of failures until experiment is stopped
27-
* @param p success probability
28-
* @return mode
26+
* @param r number of failures until experiment is stopped
27+
* @param p success probability
28+
* @return mode
29+
*
2930
* @example
3031
* double v = stdlib_base_dists_negative_binomial_mode( 100.0, 0.2 );
3132
* // returns 396.0
@@ -35,8 +36,8 @@ double stdlib_base_dists_negative_binomial_mode( const double r, const double p
3536
stdlib_base_is_nan( r ) ||
3637
stdlib_base_is_nan( p ) ||
3738
r <= 0.0 ||
38-
p < 0.0 ||
39-
p > 1.0
39+
p < 0.0 ||
40+
p > 1.0
4041
) {
4142
return 0.0 / 0.0; // NaN
4243
}

0 commit comments

Comments
 (0)