Skip to content

Commit 1066736

Browse files
committed
updated the return value and refactored the calculation using discrete-uniform
1 parent cf81564 commit 1066736

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/node_modules/@stdlib/stats/base/dists/binomial/median/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Returns the [median][median] of a [binomial][binomial-distribution] distribution
173173

174174
```c
175175
double out = stdlib_base_dists_binomial_median( 100, 0.1 );
176-
// returns 10
176+
// returns 10.0
177177
```
178178

179179
The function accepts the following arguments:

lib/node_modules/@stdlib/stats/base/dists/binomial/median/benchmark/benchmark.native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var Float64Array = require( '@stdlib/array/float64' );
2727
var tryRequire = require( '@stdlib/utils/try-require' );
2828
var ceil = require( '@stdlib/math/base/special/ceil' );
2929
var randu = require( '@stdlib/random/base/randu' );
30+
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
3031
var isnan = require( '@stdlib/math/base/assert/is-nan' );
3132
var pkg = require( './../package.json' ).name;
3233

@@ -49,10 +50,9 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4950
var i;
5051

5152
len = 100;
52-
n = new Int32Array( len );
53+
n = discreteUniform( len, 1, 100 );
5354
p = new Float64Array( len );
5455
for ( i = 0; i < len; i++ ) {
55-
n[ i ] = ceil( randu() * 100.0 );
5656
p[ i ] = randu();
5757
}
5858

lib/node_modules/@stdlib/stats/base/dists/binomial/median/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
* @example
3232
* double y = stdlib_base_dists_binomial_median( 100, 0.1 );
33-
* // returns 10
33+
* // returns 10.0
3434
*/
3535
double stdlib_base_dists_binomial_median( const int32_t n, const double p ) {
3636
if (

0 commit comments

Comments
 (0)