@@ -65,15 +65,31 @@ The namespace contains the following:
65
65
66
66
## Examples
67
67
68
- <!-- TODO: better examples -->
69
-
70
68
<!-- eslint no-undef: "error" -->
71
69
72
70
``` javascript
73
- var objectKeys = require ( ' @stdlib/utils/keys' );
71
+ var exponential = require ( ' @stdlib/random/base/exponential' );
72
+ var arcsine = require ( ' @stdlib/random/base/arcsine' );
73
+ var randn = require ( ' @stdlib/random/base/improved-ziggurat' );
74
74
var ns = require ( ' @stdlib/random/array/tools' );
75
75
76
- console .log ( objectKeys ( ns ) );
76
+ // Create a binary PRNG array:
77
+ var dtypes = [ ' float64' , ' float32' , ' generic' ];
78
+ var defaultDType = ' float64' ;
79
+
80
+ var rand = new ns.binary ( arcsine, dtypes, defaultDType );
81
+ var x = rand .generate ( 10 , 2.0 , 5.0 );
82
+ // e.g., returns <Float64Array>[ ~3.65, ~4.34, ~3.52, ~4.68, ~2.62, ... ]
83
+
84
+ // Create a unary PRNG array:
85
+ rand = new ns.unary ( exponential, dtypes, defaultDType );
86
+ x = rand .generate ( 10 , 0.5 );
87
+ // e.g., returns <Float64Array>[ ~0.22, ~2.89, ~0.69, ~2.48, ~0.82, ... ]
88
+
89
+ // Create a nullary PRNG array:
90
+ rand = new ns.nullary ( randn, dtypes, defaultDType );
91
+ x = rand .generate ( 10 );
92
+ // e.g., returns <Float64Array>[ ~-0.22, ~1.89, ~-0.69, ~0.48, ~-0.82, ... ]
77
93
```
78
94
79
95
</section >
0 commit comments