Skip to content

Commit 78cf43e

Browse files
committed
Auto-generated commit
1 parent 77566c2 commit 78cf43e

File tree

4 files changed

+22
-27
lines changed

4 files changed

+22
-27
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ A total of 2 issues were closed in this release:
3434

3535
<details>
3636

37+
- [`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)_
3738
- [`e658ffd`](https://github.com/stdlib-js/stdlib/commit/e658ffd3c46b5cb1ba33c0be61e55bf6995237ca) - **bench:** update random value generation [(#6856)](https://github.com/stdlib-js/stdlib/pull/6856) _(by Harsh)_
3839
- [`a1e230f`](https://github.com/stdlib-js/stdlib/commit/a1e230f29297caa89880e9c194c615a0400fb7bc) - **chore:** clean up cppcheck-suppress comments _(by Karan Anand)_
3940
- [`7fc07a2`](https://github.com/stdlib-js/stdlib/commit/7fc07a2122bb9e862ae7e2237dd48096051199dd) - **docs:** fix missing section tags in various READMEs [(#5322)](https://github.com/stdlib-js/stdlib/pull/5322) _(by Saurabh Singh)_
@@ -51,8 +52,9 @@ A total of 2 issues were closed in this release:
5152

5253
### Contributors
5354

54-
A total of 5 people contributed to this release. Thank you to the following contributors:
55+
A total of 6 people contributed to this release. Thank you to the following contributors:
5556

57+
- Athan Reines
5658
- Harsh
5759
- Karan Anand
5860
- Philipp Burckhardt

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,18 @@ v = mean( 20, 1.5 );
153153
<!-- eslint no-undef: "error" -->
154154

155155
```javascript
156-
var randu = require( '@stdlib/random-base-randu' );
157-
var round = require( '@stdlib/math-base-special-round' );
156+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
157+
var uniform = require( '@stdlib/random-array-uniform' );
158+
var logEachMap = require( '@stdlib/console-log-each-map' );
158159
var mean = require( '@stdlib/stats-base-dists-binomial-mean' );
159160

160-
var v;
161-
var i;
162-
var n;
163-
var p;
161+
var opts = {
162+
'dtype': 'float64'
163+
};
164+
var n = discreteUniform( 10, 0, 100, opts );
165+
var p = uniform( 10, 0.0, 1.0, opts );
164166

165-
for ( i = 0; i < 10; i++ ) {
166-
n = round( randu() * 100.0 );
167-
p = randu();
168-
v = mean( n, p );
169-
console.log( 'n: %d, p: %d, E(X;n,p): %d', n, p.toFixed( 4 ), v.toFixed( 4 ) );
170-
}
167+
logEachMap( 'n: %0.4f, p: %0.4f, E(X;n,p): %0.4f', n, p, mean );
171168
```
172169

173170
</section>

examples/index.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,15 @@
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 mean = require( './../lib' );
2425

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

30-
for ( i = 0; i < 10; i++ ) {
31-
n = round( randu() * 100.0 );
32-
p = randu();
33-
v = mean( n, p );
34-
console.log( 'n: %d, p: %d, E(X;n,p): %d', n, p.toFixed( 4 ), v.toFixed( 4 ) );
35-
}
32+
logEachMap( 'n: %0.4f, p: %0.4f, E(X;n,p): %0.4f', n, p, mean );

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,11 @@
4747
"@stdlib/utils-library-manifest": "^0.2.2"
4848
},
4949
"devDependencies": {
50+
"@stdlib/console-log-each-map": "github:stdlib-js/console-log-each-map#main",
5051
"@stdlib/constants-float64-ninf": "^0.2.2",
5152
"@stdlib/math-base-special-ceil": "^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
"@stdlib/utils-try-require": "^0.2.2",
5756
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
5857
"istanbul": "^0.4.1",

0 commit comments

Comments
 (0)