Skip to content

Commit 53caa40

Browse files
committed
Auto-generated commit
1 parent f647e27 commit 53caa40

File tree

4 files changed

+25
-32
lines changed

4 files changed

+25
-32
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
<details>
1414

15+
- [`c1df69c`](https://github.com/stdlib-js/stdlib/commit/c1df69ccf92f1ce80f08883226dd4252644f0324) - **docs:** replace manual `for` loop in examples [(#6848)](https://github.com/stdlib-js/stdlib/pull/6848) _(by Harsh, Athan Reines)_
1516
- [`7279e43`](https://github.com/stdlib-js/stdlib/commit/7279e433dc1936056560624b5892eea8d9350ef1) - **bench:** update random value generation [(#6853)](https://github.com/stdlib-js/stdlib/pull/6853) _(by Harsh)_
1617
- [`af55f0d`](https://github.com/stdlib-js/stdlib/commit/af55f0d6d6b4d06c36f46357740ea89a4639ab5b) - **bench:** refactor random number generation in `stats/base/dists/binomial` [(#4841)](https://github.com/stdlib-js/stdlib/pull/4841) _(by Karan Anand)_
1718

@@ -25,8 +26,9 @@
2526

2627
### Contributors
2728

28-
A total of 2 people contributed to this release. Thank you to the following contributors:
29+
A total of 3 people contributed to this release. Thank you to the following contributors:
2930

31+
- Athan Reines
3032
- Harsh
3133
- Karan Anand
3234

README.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -177,23 +177,19 @@ y = mycdf( 1.0 );
177177
<!-- eslint no-undef: "error" -->
178178

179179
```javascript
180-
var randu = require( '@stdlib/random-base-randu' );
181-
var round = require( '@stdlib/math-base-special-round' );
180+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
181+
var uniform = require( '@stdlib/random-array-uniform' );
182+
var logEachMap = require( '@stdlib/console-log-each-map' );
182183
var cdf = require( '@stdlib/stats-base-dists-binomial-cdf' );
183184

184-
var i;
185-
var n;
186-
var p;
187-
var x;
188-
var y;
189-
190-
for ( i = 0; i < 10; i++ ) {
191-
x = randu() * 20.0;
192-
n = round( randu() * 100.0 );
193-
p = randu();
194-
y = cdf( x, n, p );
195-
console.log( 'x: %d, n: %d, p: %d, F(x;n,p): %d', x.toFixed( 4 ), n, p.toFixed( 4 ), y.toFixed( 4 ) );
196-
}
185+
var opts = {
186+
'dtype': 'float64'
187+
};
188+
var x = uniform( 10, 0.0, 20.0, opts );
189+
var n = discreteUniform( 10, 0, 100, opts );
190+
var p = uniform( 10, 0.0, 1.0, opts );
191+
192+
logEachMap( 'x: %0.4f, n: %0.4f, p: %0.4f, F(x;n,p): %0.4f', x, n, p, cdf );
197193
```
198194

199195
</section>

examples/index.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,16 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random-base-randu' );
22-
var round = require( '@stdlib/math-base-special-round' );
21+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
22+
var uniform = require( '@stdlib/random-array-uniform' );
23+
var logEachMap = require( '@stdlib/console-log-each-map' );
2324
var cdf = require( './../lib' );
2425

25-
var i;
26-
var n;
27-
var p;
28-
var x;
29-
var y;
26+
var opts = {
27+
'dtype': 'float64'
28+
};
29+
var x = uniform( 10, 0.0, 20.0, opts );
30+
var n = discreteUniform( 10, 0, 100, opts );
31+
var p = uniform( 10, 0.0, 1.0, opts );
3032

31-
for ( i = 0; i < 10; i++ ) {
32-
x = randu() * 20.0;
33-
n = round( randu() * 100.0 );
34-
p = randu();
35-
y = cdf( x, n, p );
36-
console.log( 'x: %d, n: %d, p: %d, F(x;n,p): %d', x.toFixed( 4 ), n, p.toFixed( 4 ), y.toFixed( 4 ) );
37-
}
33+
logEachMap( 'x: %0.4f, n: %0.4f, p: %0.4f, F(x;n,p): %0.4f', x, n, p, cdf );

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,12 @@
4646
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2"
4747
},
4848
"devDependencies": {
49+
"@stdlib/console-log-each-map": "github:stdlib-js/console-log-each-map#main",
4950
"@stdlib/constants-float64-eps": "^0.2.2",
5051
"@stdlib/constants-float64-ninf": "^0.2.2",
5152
"@stdlib/math-base-special-abs": "^0.2.2",
52-
"@stdlib/math-base-special-round": "^0.3.0",
5353
"@stdlib/random-array-discrete-uniform": "^0.2.1",
5454
"@stdlib/random-array-uniform": "^0.2.1",
55-
"@stdlib/random-base-randu": "^0.2.1",
5655
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
5756
"istanbul": "^0.4.1",
5857
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",

0 commit comments

Comments
 (0)