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 );
5757
5858``` javascript
5959var uniform = require ( ' @stdlib/random/array/uniform' );
60+ var logEachMap = require ( ' @stdlib/console/log-each-map' );
6061var isProbability = require ( ' @stdlib/math/base/assert/is-probability' );
6162
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 );
6367
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' ;
6770}
71+ logEachMap ( ' %0.4f is %s' , x, isProbabilityWrapper );
6872```
6973
7074</section >
Original file line number Diff line number Diff line change 1919'use strict' ;
2020
2121var uniform = require ( '@stdlib/random/array/uniform' ) ;
22+ var logEachMap = require ( '@stdlib/console/log-each-map' ) ;
2223var isProbability = require ( './../lib' ) ;
2324
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 ) ;
2529
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' ;
2932}
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 );
5757
5858``` javascript
5959var uniform = require ( ' @stdlib/random/array/uniform' );
60+ var logEachMap = require ( ' @stdlib/console/log-each-map' );
6061var isProbabilityf = require ( ' @stdlib/math/base/assert/is-probabilityf' );
6162
62- var x = uniform ( 100 , - 1.0 , 1.0 , {
63+ var opts = {
6364 ' dtype' : ' float32'
64- });
65+ };
66+ var x = uniform ( 100 , - 1.0 , 1.0 , opts );
6567
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' ;
6970}
71+ logEachMap ( ' %0.4f is %s' , x, isProbabilityfWrapper );
7072```
7173
7274</section >
Original file line number Diff line number Diff line change 1919'use strict' ;
2020
2121var uniform = require ( '@stdlib/random/array/uniform' ) ;
22+ var logEachMap = require ( '@stdlib/console/log-each-map' ) ;
2223var isProbabilityf = require ( './../lib' ) ;
2324
24- var x = uniform ( 100 , - 1.0 , 1.0 , {
25+ var opts = {
2526 'dtype' : 'float32'
26- } ) ;
27+ } ;
28+ var x = uniform ( 100 , - 1.0 , 1.0 , opts ) ;
2729
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' ;
3132}
33+ logEachMap ( '%0.4f is %s' , x , isProbabilityfWrapper ) ;
You can’t perform that action at this time.
0 commit comments