Skip to content

Commit 67a57a2

Browse files
Udit19199kgryte
andauthored
docs: refactor example to use array PRNG
PR-URL: #8233 Closes: #8227 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]>
1 parent 41f4ebe commit 67a57a2

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

lib/node_modules/@stdlib/utils/some-by-right/README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,16 @@ var mean = context.sum / context.count;
159159
<!-- eslint no-undef: "error" -->
160160

161161
```javascript
162-
var randu = require( '@stdlib/random/base/randu' );
162+
var randu = require( '@stdlib/random/array/randu' );
163163
var someByRight = require( '@stdlib/utils/some-by-right' );
164164

165165
function threshold( value ) {
166166
return ( value > 0.95 );
167167
}
168168

169-
var bool;
170-
var arr;
171-
var i;
169+
var arr = randu( 100 );
172170

173-
arr = new Array( 100 );
174-
for ( i = 0; i < arr.length; i++ ) {
175-
arr[ i ] = randu();
176-
}
177-
178-
bool = someByRight( arr, 5, threshold );
171+
var bool = someByRight( arr, 5, threshold );
179172
// returns <boolean>
180173
```
181174

lib/node_modules/@stdlib/utils/some-by-right/examples/index.js

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

1919
'use strict';
2020

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

2424
function threshold( value ) {
2525
return ( value > 0.95 );
2626
}
2727

28-
var bool;
29-
var arr;
30-
var i;
28+
var arr = randu( 100 );
3129

32-
arr = new Array( 100 );
33-
for ( i = 0; i < arr.length; i++ ) {
34-
arr[ i ] = randu();
35-
}
36-
37-
bool = someByRight( arr, 5, threshold );
30+
var bool = someByRight( arr, 5, threshold );
3831
console.log( bool );

0 commit comments

Comments
 (0)