File tree 4 files changed +28
-32
lines changed
lib/node_modules/@stdlib/math/base/special
4 files changed +28
-32
lines changed Original file line number Diff line number Diff line change @@ -83,17 +83,16 @@ v = inv( NaN );
83
83
<!-- eslint no-undef: "error" -->
84
84
85
85
``` javascript
86
- var randu = require ( ' @stdlib/random/base/randu ' );
87
- var round = require ( ' @stdlib/math/base/special/round ' );
86
+ var discreteUniform = require ( ' @stdlib/random/array/discrete-uniform ' );
87
+ var logEachMap = require ( ' @stdlib/console/log-each-map ' );
88
88
var inv = require ( ' @stdlib/math/base/special/inv' );
89
89
90
- var x;
91
- var i;
90
+ var opts = {
91
+ ' dtype' : ' float64'
92
+ };
93
+ var x = discreteUniform ( 100 , - 50 , 50 , opts );
92
94
93
- for ( i = 0 ; i < 100 ; i++ ) {
94
- x = round ( randu ()* 100.0 ) - 50.0 ;
95
- console .log ( ' inv(%d) = %d' , x, inv ( x ) );
96
- }
95
+ logEachMap ( ' inv(%0.4f) = %0.4f' , x, inv );
97
96
```
98
97
99
98
</section >
Original file line number Diff line number Diff line change 18
18
19
19
'use strict' ;
20
20
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 logEachMap = require ( '@stdlib/console/log-each-map ' ) ;
23
23
var inv = require ( './../lib' ) ;
24
24
25
- var x ;
26
- var i ;
25
+ var opts = {
26
+ 'dtype' : 'float64'
27
+ } ;
28
+ var x = discreteUniform ( 100 , - 50 , 50 , opts ) ;
27
29
28
- for ( i = 0 ; i < 100 ; i ++ ) {
29
- x = round ( randu ( ) * 100.0 ) - 50.0 ;
30
- console . log ( 'inv(%d) = %d' , x , inv ( x ) ) ;
31
- }
30
+ logEachMap ( 'inv(%0.4f) = %0.4f' , x , inv ) ;
Original file line number Diff line number Diff line change @@ -83,17 +83,16 @@ v = invf( NaN );
83
83
<!-- eslint no-undef: "error" -->
84
84
85
85
``` javascript
86
- var randu = require ( ' @stdlib/random/base/randu ' );
87
- var round = require ( ' @stdlib/math/base/special/round ' );
86
+ var discreteUniform = require ( ' @stdlib/random/array/discrete-uniform ' );
87
+ var logEachMap = require ( ' @stdlib/console/log-each-map ' );
88
88
var invf = require ( ' @stdlib/math/base/special/invf' );
89
89
90
- var x;
91
- var i;
90
+ var opts = {
91
+ ' dtype' : ' float32'
92
+ };
93
+ var x = discreteUniform ( 100 , - 50 , 50 , opts );
92
94
93
- for ( i = 0 ; i < 100 ; i++ ) {
94
- x = round ( randu ()* 100.0 ) - 50.0 ;
95
- console .log ( ' invf(%d) = %d' , x, invf ( x ) );
96
- }
95
+ logEachMap ( ' invf(%0.4f) = %0.4f' , x, invf );
97
96
```
98
97
99
98
</section >
Original file line number Diff line number Diff line change 18
18
19
19
'use strict' ;
20
20
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 logEachMap = require ( '@stdlib/console/log-each-map ' ) ;
23
23
var invf = require ( './../lib' ) ;
24
24
25
- var x ;
26
- var i ;
25
+ var opts = {
26
+ 'dtype' : 'float32'
27
+ } ;
28
+ var x = discreteUniform ( 100 , - 50 , 50 , opts ) ;
27
29
28
- for ( i = 0 ; i < 100 ; i ++ ) {
29
- x = round ( randu ( ) * 100.0 ) - 50.0 ;
30
- console . log ( 'invf(%d) = %d' , x , invf ( x ) ) ;
31
- }
30
+ logEachMap ( 'invf(%0.4f) = %0.4f' , x , invf ) ;
You can’t perform that action at this time.
0 commit comments