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
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/random/tools/unary/README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ limitations under the License.
20
20
21
21
# Random
22
22
23
-
> Constructor for creating ndarrays filled with pseudorandom numbers drawn from a single-parameter probability distribution.
23
+
> Constructor for creating ndarrays filled with pseudorandom values drawn from a unary PRNG.
24
24
25
25
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26
26
@@ -42,7 +42,7 @@ var Random = require( '@stdlib/random/tools/unary' );
Returns an ndarray filled with pseudorandom numbers drawn from a probability distribution.
84
+
Returns an ndarray filled with pseudorandom values drawn from a unary PRNG.
85
85
86
86
```javascript
87
87
var dtypes =require( '@stdlib/ndarray/dtypes' );
@@ -106,7 +106,7 @@ var v = rand.generate( [ 2, 2 ], 2.0 );
106
106
The method has the following parameters:
107
107
108
108
-**shape**: output ndarray shape.
109
-
-**param1**: distribution parameter. May be either a scalar or an ndarray. If an ndarray, must be [broadcast compatible][@stdlib/ndarray/base/broadcast-shapes] with the specified output ndarray shape.
109
+
-**param1**: PRNG parameter. May be either a scalar or an ndarray. If an ndarray, must be [broadcast compatible][@stdlib/ndarray/base/broadcast-shapes] with the specified output ndarray shape.
110
110
-**options**: function options (_optional_).
111
111
112
112
The method accepts the following options:
@@ -147,7 +147,7 @@ var dt = getDType( v );
147
147
148
148
#### Random.prototype.assign( param1, out )
149
149
150
-
Fills an ndarray with pseudorandom numbers drawn from a probability distribution.
150
+
Fills an ndarray with pseudorandom values drawn from a unary PRNG.
151
151
152
152
```javascript
153
153
var dtypes =require( '@stdlib/ndarray/dtypes' );
@@ -176,7 +176,7 @@ var bool = ( v === out );
176
176
177
177
The method has the following parameters:
178
178
179
-
-**param1**: distribution parameter. May be either a scalar or an ndarray. If an ndarray, must be [broadcast compatible][@stdlib/ndarray/base/broadcast-shapes] with the output ndarray.
179
+
-**param1**: PRNG parameter. May be either a scalar or an ndarray. If an ndarray, must be [broadcast compatible][@stdlib/ndarray/base/broadcast-shapes] with the output ndarray.
// Check whether the distribution parameter is a zero-dimensional array...
265
+
// Check whether the PRNG parameter is a zero-dimensional array...
266
266
if(sh.length===0){
267
267
p1=param1.get();
268
268
FLG=true;
269
269
}else{
270
-
// Broadcast the distribution parameter to the desired shape:
270
+
// Broadcast the PRNG parameter to the desired shape:
271
271
p1=broadcast(param1,shape);// delegate to `broadcast` to ensure broadcast compatibility
272
272
FLG=false;
273
273
}
274
274
}else{
275
-
thrownewTypeError(format('invalid argument. Second argument must be either a scalar or an ndarray-like object. Value: `%s`.',param1));
275
+
p1=param1;
276
+
dt='generic';
277
+
FLG=true;
276
278
}
277
279
if(!contains(this._idtypes,dt)){
278
280
thrownewTypeError(format('invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.',join(this._idtypes,'", "'),dt));
// If provided a scalar distribution parameter, we can simply fill a linear buffer with pseudorandom numbers (as all pseudorandom numbers are drawn from the same distribution) and then wrap as an ndarray...
312
+
// If provided a scalar PRNG parameter, we can simply fill a linear buffer with pseudorandom values (as all pseudorandom values are drawn from the same PRNG) and then wrap as an ndarray...
thrownewTypeError(format('invalid argument. First argument must have one of the following data types: "%s". Data type: `%s`.',join(this._idtypes,'", "'),pdt));
@@ -418,7 +422,7 @@ setReadOnly( Random.prototype, 'assign', function assign( param1, out ) {
418
422
if(!contains(this._odtypes,odt)){
419
423
thrownewTypeError(format('invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.',join(this._odtypes,'", "'),odt));
420
424
}
421
-
// Fill the output array with pseudorandom numbers:
425
+
// Fill the output array with pseudorandom values:
0 commit comments