You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns a function for creating arrays containing pseudorandom numbers drawn from a [discrete uniform][@stdlib/random/base/discete-uniform] distribution.
120
+
Returns a function for creating arrays containing pseudorandom numbers drawn from a [discrete uniform][@stdlib/random/base/discrete-uniform] distribution.
98
121
99
122
```javascript
100
123
var random =discreteUniform.factory();
@@ -106,7 +129,7 @@ var len = out.length;
106
129
// returns 10
107
130
```
108
131
109
-
If provided `a` and `b`, the returned generator returns random variates from the specified distribution.
132
+
If provided distribution parameters, the returned generator returns random variates from the specified distribution.
110
133
111
134
```javascript
112
135
var random =discreteUniform.factory( -10, 10 );
@@ -118,7 +141,7 @@ out = random( 10 );
118
141
// returns <Float64Array>
119
142
```
120
143
121
-
If not provided `a` and `b`, the returned generator requires that both parameters be provided at each invocation.
144
+
If not provided distribution parameters, the returned generator requires that distribution parameters be provided at each invocation.
122
145
123
146
```javascript
124
147
var random =discreteUniform.factory();
@@ -132,8 +155,7 @@ out = random( 10, -10, 10 );
132
155
133
156
The function accepts the following `options`:
134
157
135
-
-**prng**: pseudorandom number generator for generating uniformly distributed pseudorandom numbers. If provided, the function **ignores** both the `state` and `seed` options. In order to seed the underlying pseudorandom number generator, one must seed the provided `prng` (assuming the provided `prng` is seedable).
136
-
-**seed**: pseudorandom number generator seed.
158
+
-**prng**: pseudorandom number generator for generating uniformly distributed pseudorandom integers. If provided, the function **ignores** both the `state` and `seed` options. In order to seed the returned pseudorandom number generator, one must seed the provided `prng` (assuming the provided `prng` is seedable). The provided PRNG **must** have `MIN` and `MAX` properties specifying the minimum and maximum possible pseudorandom integers.
137
159
-**state**: a [`Uint32Array`][@stdlib/array/uint32] containing pseudorandom number generator state. If provided, the function ignores the `seed` option.
138
160
-**copy**: `boolean` indicating whether to copy a provided pseudorandom number generator state. Setting this option to `false` allows sharing state between two or more pseudorandom number generators. Setting this option to `true` ensures that an underlying generator has exclusive control over its internal state. Default: `true`.
139
161
-**dtype**: default output array data type. Must be a [real-valued data type][@stdlib/array/typed-real-dtypes] or "generic". Default: `'float64'`.
@@ -339,7 +361,7 @@ var x2 = random( 5 );
339
361
var x3 =random( 5 );
340
362
341
363
// Print the contents:
342
-
logEach( '%d, %d, %d', x1, x2, x3 );
364
+
logEach( '%f, %f, %f', x1, x2, x3 );
343
365
344
366
// Create another function for generating random arrays with the original state:
345
367
random =discreteUniform.factory( -10, 10, {
@@ -351,7 +373,7 @@ random = discreteUniform.factory( -10, 10, {
351
373
var x4 =random( 15 );
352
374
353
375
// Print the contents:
354
-
logEach( '%d', x4 );
376
+
logEach( '%f', x4 );
355
377
```
356
378
357
379
</section>
@@ -362,14 +384,6 @@ logEach( '%d', x4 );
362
384
363
385
<sectionclass="related">
364
386
365
-
* * *
366
-
367
-
## See Also
368
-
369
-
- <spanclass="package-name">[`@stdlib/random-array/uniform`][@stdlib/random/array/uniform]</span><spanclass="delimiter">: </span><spanclass="description">create an array containing pseudorandom numbers drawn from a continuous uniform distribution.</span>
- <spanclass="package-name">[`@stdlib/random-strided/discrete-uniform`][@stdlib/random/strided/discrete-uniform]</span><spanclass="delimiter">: </span><spanclass="description">fill a strided array with pseudorandom numbers drawn from a discrete uniform distribution.</span>
0 commit comments