Skip to content

Commit 2bb2164

Browse files
committed
docs: update examples
1 parent 3f7f442 commit 2bb2164

2 files changed

Lines changed: 8 additions & 16 deletions

File tree

lib/node_modules/@stdlib/complex/cmplx/README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,15 @@ var z = complex( 5.0, 3.0, 'float32' );
8080
<!-- eslint no-undef: "error" -->
8181

8282
```javascript
83-
var randu = require( '@stdlib/random/base/randu' );
84-
var round = require( '@stdlib/math/base/special/round' );
83+
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
8584
var complex = require( '@stdlib/complex/cmplx' );
8685

87-
var re;
88-
var im;
86+
var rand = discreteUniform( -50, 50 );
87+
8988
var z;
9089
var i;
91-
9290
for ( i = 0; i < 100; i++ ) {
93-
re = round( (randu()*100.0) - 50.0 );
94-
im = round( (randu()*100.0) - 50.0 );
95-
z = complex( re, im, 'float64' );
91+
z = complex( rand(), rand(), 'float64' );
9692
console.log( z.toString() );
9793
}
9894
```

lib/node_modules/@stdlib/complex/cmplx/examples/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,14 @@
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/base/discrete-uniform' ).factory;
2322
var complex = require( './../lib' );
2423

25-
var re;
26-
var im;
24+
var rand = discreteUniform( -50, 50 );
25+
2726
var z;
2827
var i;
29-
3028
for ( i = 0; i < 100; i++ ) {
31-
re = round( (randu()*100.0) - 50.0 );
32-
im = round( (randu()*100.0) - 50.0 );
33-
z = complex( re, im, 'float64' );
29+
z = complex( rand(), rand(), 'float64' );
3430
console.log( z.toString() );
3531
}

0 commit comments

Comments
 (0)