File tree Expand file tree Collapse file tree 4 files changed +30
-18
lines changed
lib/node_modules/@stdlib/math/base/assert Expand file tree Collapse file tree 4 files changed +30
-18
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,18 @@ bool = isProbability( NaN );
57
57
58
58
``` javascript
59
59
var uniform = require ( ' @stdlib/random/array/uniform' );
60
+ var logEachMap = require ( ' @stdlib/console/log-each-map' );
60
61
var isProbability = require ( ' @stdlib/math/base/assert/is-probability' );
61
62
62
- var x = uniform ( 100 , - 1.0 , 1.0 );
63
+ var opts = {
64
+ ' dtype' : ' float64'
65
+ };
66
+ var x = uniform ( 100 , - 1.0 , 1.0 , opts );
63
67
64
- var i;
65
- for ( i = 0 ; i < x .length ; i++ ) {
66
- console .log ( ' %d is %s' , x[ i ], ( isProbability ( x[ i ] ) ) ? ' a probability' : ' not a probability' );
68
+ function isProbabilityWrapper ( integer ) {
69
+ return ( isProbability ( integer ) ) ? ' a probability' : ' not a probability' ;
67
70
}
71
+ logEachMap ( ' %0.4f is %s' , x, isProbabilityWrapper );
68
72
```
69
73
70
74
</section >
Original file line number Diff line number Diff line change 19
19
'use strict' ;
20
20
21
21
var uniform = require ( '@stdlib/random/array/uniform' ) ;
22
+ var logEachMap = require ( '@stdlib/console/log-each-map' ) ;
22
23
var isProbability = require ( './../lib' ) ;
23
24
24
- var x = uniform ( 100 , - 1.0 , 1.0 ) ;
25
+ var opts = {
26
+ 'dtype' : 'float64'
27
+ } ;
28
+ var x = uniform ( 100 , - 1.0 , 1.0 , opts ) ;
25
29
26
- var i ;
27
- for ( i = 0 ; i < x . length ; i ++ ) {
28
- console . log ( '%d is %s' , x [ i ] , ( isProbability ( x [ i ] ) ) ? 'a probability' : 'not a probability' ) ;
30
+ function isProbabilityWrapper ( integer ) {
31
+ return ( isProbability ( integer ) ) ? 'a probability' : 'not a probability' ;
29
32
}
33
+ logEachMap ( '%0.4f is %s' , x , isProbabilityWrapper ) ;
Original file line number Diff line number Diff line change @@ -57,16 +57,18 @@ bool = isProbabilityf( NaN );
57
57
58
58
``` javascript
59
59
var uniform = require ( ' @stdlib/random/array/uniform' );
60
+ var logEachMap = require ( ' @stdlib/console/log-each-map' );
60
61
var isProbabilityf = require ( ' @stdlib/math/base/assert/is-probabilityf' );
61
62
62
- var x = uniform ( 100 , - 1.0 , 1.0 , {
63
+ var opts = {
63
64
' dtype' : ' float32'
64
- });
65
+ };
66
+ var x = uniform ( 100 , - 1.0 , 1.0 , opts );
65
67
66
- var i;
67
- for ( i = 0 ; i < 100 ; i++ ) {
68
- console .log ( ' %d is %s' , x[ i ], ( isProbabilityf ( x[ i ] ) ) ? ' a probability' : ' not a probability' );
68
+ function isProbabilityfWrapper ( integer ) {
69
+ return ( isProbabilityf ( integer ) ) ? ' a probability' : ' not a probability' ;
69
70
}
71
+ logEachMap ( ' %0.4f is %s' , x, isProbabilityfWrapper );
70
72
```
71
73
72
74
</section >
Original file line number Diff line number Diff line change 19
19
'use strict' ;
20
20
21
21
var uniform = require ( '@stdlib/random/array/uniform' ) ;
22
+ var logEachMap = require ( '@stdlib/console/log-each-map' ) ;
22
23
var isProbabilityf = require ( './../lib' ) ;
23
24
24
- var x = uniform ( 100 , - 1.0 , 1.0 , {
25
+ var opts = {
25
26
'dtype' : 'float32'
26
- } ) ;
27
+ } ;
28
+ var x = uniform ( 100 , - 1.0 , 1.0 , opts ) ;
27
29
28
- var i ;
29
- for ( i = 0 ; i < 100 ; i ++ ) {
30
- console . log ( '%d is %s' , x [ i ] , ( isProbabilityf ( x [ i ] ) ) ? 'a probability' : 'not a probability' ) ;
30
+ function isProbabilityfWrapper ( integer ) {
31
+ return ( isProbabilityf ( integer ) ) ? 'a probability' : 'not a probability' ;
31
32
}
33
+ logEachMap ( '%0.4f is %s' , x , isProbabilityfWrapper ) ;
You can’t perform that action at this time.
0 commit comments