Skip to content

Commit 393c150

Browse files
committed
docs: update descriptions to be more neutral regarding output values
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 3d9063e commit 393c150

File tree

5 files changed

+47
-45
lines changed

5 files changed

+47
-45
lines changed

lib/node_modules/@stdlib/random/tools/unary/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# Random
2222

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.
2424
2525
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
2626

@@ -42,7 +42,7 @@ var Random = require( '@stdlib/random/tools/unary' );
4242

4343
#### Random( prng, idtypes odtypes, policies\[, options] )
4444

45-
Returns an interface for creating ndarrays filled with pseudorandom numbers drawn from a single-parameter probability distribution.
45+
Returns an interface for creating ndarrays filled with pseudorandom values drawn from a unary PRNG.
4646

4747
```javascript
4848
var dtypes = require( '@stdlib/ndarray/dtypes' );
@@ -63,7 +63,7 @@ var rand = new Random( exponential, idt, odt, policies, options );
6363

6464
The constructor has the following parameters:
6565

66-
- **prng**: unary pseudorandom number generator.
66+
- **prng**: unary pseudorandom value generator.
6767

6868
- **idtypes**: list of supported input data types.
6969

@@ -77,11 +77,11 @@ The constructor has the following parameters:
7777

7878
The constructor supports the following options:
7979

80-
- **order**: default memory layout [order][@stdlib/ndarray/orders].
80+
- **order**: default [memory layout][@stdlib/ndarray/orders].
8181

8282
#### Random.prototype.generate( shape, param1\[, options] )
8383

84-
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.
8585

8686
```javascript
8787
var dtypes = require( '@stdlib/ndarray/dtypes' );
@@ -106,7 +106,7 @@ var v = rand.generate( [ 2, 2 ], 2.0 );
106106
The method has the following parameters:
107107

108108
- **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.
110110
- **options**: function options (_optional_).
111111

112112
The method accepts the following options:
@@ -147,7 +147,7 @@ var dt = getDType( v );
147147

148148
#### Random.prototype.assign( param1, out )
149149

150-
Fills an ndarray with pseudorandom numbers drawn from a probability distribution.
150+
Fills an ndarray with pseudorandom values drawn from a unary PRNG.
151151

152152
```javascript
153153
var dtypes = require( '@stdlib/ndarray/dtypes' );
@@ -176,7 +176,7 @@ var bool = ( v === out );
176176

177177
The method has the following parameters:
178178

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.
180180
- **out**: output ndarray.
181181

182182
</section>

lib/node_modules/@stdlib/random/tools/unary/docs/repl.txt

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
{{alias}}( prng, idtypes, odtypes, policies[, options] )
3-
Returns an interface for creating ndarrays filled with pseudorandom numbers
4-
drawn from a single-parameter probability distribution.
3+
Returns an interface for creating ndarrays filled with pseudorandom values
4+
drawn from a unary PRNG.
55

66
Parameters
77
----------
88
prng: Function
9-
Unary pseudorandom number generator.
9+
Unary pseudorandom value generator.
1010

1111
idtypes: Array<string>
1212
List of supported input data types.
@@ -23,12 +23,12 @@
2323
Function options.
2424

2525
options.order: string (optional)
26-
Default memory layout order.
26+
Default memory layout.
2727

2828
Returns
2929
-------
3030
out: Object
31-
Instance having methods for generating pseudorandom numbers.
31+
Instance having methods for generating pseudorandom values.
3232

3333
Examples
3434
--------
@@ -39,17 +39,16 @@
3939

4040

4141
{{alias}}.prototype.generate( shape, param1[, options] )
42-
Returns an ndarray filled with pseudorandom numbers drawn from a probability
43-
distribution.
42+
Returns an ndarray filled with pseudorandom values drawn from a unary PRNG.
4443

4544
Parameters
4645
----------
4746
shape: Array<integer>
4847
Output shape.
4948

50-
param1: number|ComplexLike|ndarray
51-
Distribution parameter. If an ndarray, must be broadcast compatible with
52-
the specified output shape.
49+
param1: ndarray|any
50+
PRNG parameter. If an ndarray, must be broadcast compatible with the
51+
specified output shape.
5352

5453
options: Object (optional)
5554
Function options.
@@ -89,14 +88,13 @@
8988

9089

9190
{{alias}}.prototype.assign( param1, out[, options] )
92-
Fills an ndarray with pseudorandom numbers drawn from a probability
93-
distribution.
91+
Fills an ndarray with pseudorandom values drawn from a unary PRNG.
9492

9593
Parameters
9694
----------
97-
param1: number|ComplexLike|ndarray
98-
Distribution parameter. If an ndarray, must be broadcast compatible with
99-
the output ndarray.
95+
param1: ndarray|any
96+
PRNG parameter. If an ndarray, must be broadcast compatible with the
97+
output ndarray.
10098

10199
out: ndarray
102100
Output ndarray.

lib/node_modules/@stdlib/random/tools/unary/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
/**
22-
* Constructor for creating ndarrays filled with pseudorandom numbers drawn from a single-parameter probability distribution.
22+
* Constructor for creating ndarrays filled with pseudorandom values drawn from a unary PRNG.
2323
*
2424
* @module @stdlib/random/tools/unary
2525
*

lib/node_modules/@stdlib/random/tools/unary/lib/main.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ var validate = require( './validate.js' );
6464
// MAIN //
6565

6666
/**
67-
* Constructor for creating ndarrays filled with pseudorandom numbers drawn from a single-parameter probability distribution.
67+
* Constructor for creating ndarrays filled with pseudorandom values drawn from a unary PRNG.
6868
*
6969
* @constructor
70-
* @param {Function} prng - unary pseudorandom number generator
70+
* @param {Function} prng - unary pseudorandom value generator
7171
* @param {StringArray} idtypes - list of supported input data types
7272
* @param {StringArray} odtypes - list of supported output data types
7373
* @param {Object} policies - policies
@@ -181,22 +181,22 @@ function Random( prng, idtypes, odtypes, policies, options ) {
181181
}
182182

183183
/**
184-
* Returns an ndarray filled with pseudorandom numbers drawn from a probability distribution.
184+
* Returns an ndarray filled with pseudorandom values drawn from a unary PRNG.
185185
*
186186
* @name generate
187187
* @memberof Random.prototype
188188
* @type {Function}
189189
* @param {NonNegativeIntegerArray} shape - output shape
190-
* @param {(number|ComplexLike|ndarrayLike)} param1 - distribution parameter
190+
* @param {(ndarrayLike|*)} param1 - PRNG parameter
191191
* @param {Options} [options] - function options
192192
* @param {string} [options.dtype] - output ndarray data type
193193
* @param {string} [options.order] - memory layout (either row-major or column-major)
194194
* @param {string} [options.mode] - specifies how to handle indices which exceed ndarray dimensions
195195
* @param {StringArray} [options.submode] - specifies how to handle subscripts which exceed ndarray dimensions on a per dimension basis
196196
* @param {boolean} [options.readonly] - boolean indicating whether an ndarray should be read-only
197197
* @throws {TypeError} first argument must be a valid shape
198-
* @throws {TypeError} must provide valid distribution parameters
199-
* @throws {TypeError} distribution parameters and the desired shape must be broadcast compatible
198+
* @throws {TypeError} must provide valid PRNG parameters
199+
* @throws {TypeError} PRNG parameters and the desired shape must be broadcast compatible
200200
* @throws {TypeError} options argument must be an object
201201
* @throws {TypeError} must provide valid options
202202
* @returns {ndarray} output ndarray
@@ -245,7 +245,7 @@ setReadOnly( Random.prototype, 'generate', function generate( shape, param1, opt
245245
throw err;
246246
}
247247
}
248-
// Check whether we've been provided a scalar distribution parameter...
248+
// Check whether we've been provided a scalar PRNG parameter...
249249
if ( isNumber( param1 ) ) {
250250
p1 = param1;
251251
dt = 'float64';
@@ -262,17 +262,19 @@ setReadOnly( Random.prototype, 'generate', function generate( shape, param1, opt
262262
dt = getDType( param1 );
263263
sh = getShape( param1 );
264264

265-
// Check whether the distribution parameter is a zero-dimensional array...
265+
// Check whether the PRNG parameter is a zero-dimensional array...
266266
if ( sh.length === 0 ) {
267267
p1 = param1.get();
268268
FLG = true;
269269
} else {
270-
// Broadcast the distribution parameter to the desired shape:
270+
// Broadcast the PRNG parameter to the desired shape:
271271
p1 = broadcast( param1, shape ); // delegate to `broadcast` to ensure broadcast compatibility
272272
FLG = false;
273273
}
274274
} else {
275-
throw new TypeError( 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;
276278
}
277279
if ( !contains( this._idtypes, dt ) ) {
278280
throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( this._idtypes, '", "' ), dt ) );
@@ -307,7 +309,7 @@ setReadOnly( Random.prototype, 'generate', function generate( shape, param1, opt
307309
}
308310
return new ndarray( dt, buf, shape, st, 0, ord, opts );
309311
}
310-
// 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...
311313
if ( FLG ) {
312314
if ( dt === 'generic' ) {
313315
buf = filledBy( len, wrapper );
@@ -327,7 +329,7 @@ setReadOnly( Random.prototype, 'generate', function generate( shape, param1, opt
327329
st = shape2strides( shape, ord );
328330
out = new ndarray( dt, buf, shape, st, 0, ord, opts );
329331

330-
// Fill the output array with pseudorandom numbers:
332+
// Fill the output array with pseudorandom values:
331333
unary( [ p1, out ], prng );
332334

333335
return out;
@@ -344,16 +346,16 @@ setReadOnly( Random.prototype, 'generate', function generate( shape, param1, opt
344346
});
345347

346348
/**
347-
* Fills an ndarray with pseudorandom numbers drawn from a probability distribution.
349+
* Fills an ndarray with pseudorandom values drawn from a unary PRNG.
348350
*
349351
* @name assign
350352
* @memberof Random.prototype
351353
* @type {Function}
352-
* @param {(number|ComplexLike|ndarrayLike)} param1 - distribution parameter
354+
* @param {(ndarrayLike|*)} param1 - PRNG parameter
353355
* @param {ndarrayLike} out - output ndarray
354356
* @throws {TypeError} second argument must be an ndarray
355-
* @throws {TypeError} must provide valid distribution parameters
356-
* @throws {TypeError} distribution parameters and the output ndarray must be broadcast compatible
357+
* @throws {TypeError} must provide valid PRNG parameters
358+
* @throws {TypeError} PRNG parameters and the output ndarray must be broadcast compatible
357359
* @throws {Error} cannot write to a read-only ndarray
358360
* @returns {ndarray} output ndarray
359361
*
@@ -391,7 +393,7 @@ setReadOnly( Random.prototype, 'assign', function assign( param1, out ) {
391393
if ( isReadOnly( out ) ) {
392394
throw new Error( 'invalid argument. The output ndarray must be writable. Cannot write to a read-only ndarray.' );
393395
}
394-
// Check whether we've been provided a scalar distribution parameter...
396+
// Check whether we've been provided a scalar PRNG parameter...
395397
if ( isNumber( param1 ) ) {
396398
// Wrap the scalar in a broadcasted ndarray:
397399
pdt = 'float64';
@@ -405,11 +407,13 @@ setReadOnly( Random.prototype, 'assign', function assign( param1, out ) {
405407
// Wrap the scalar in a broadcasted ndarray:
406408
p1 = broadcastScalar( param1, pdt, getShape( out ), getOrder( out ) );
407409
} else if ( isndarrayLike( param1 ) ) {
408-
// Broadcast the distribution parameter to the desired shape:
410+
// Broadcast the PRNG parameter to the desired shape:
409411
pdt = getDType( param1 );
410412
p1 = broadcast( param1, getShape( out ) ); // delegate to `broadcast` to ensure broadcast compatibility
411413
} else {
412-
throw new TypeError( format( 'invalid argument. First argument must be either a scalar or an ndarray-like object. Value: `%s`.', param1 ) );
414+
// Wrap the scalar in a broadcasted ndarray:
415+
pdt = 'generic';
416+
p1 = broadcastScalar( param1, pdt, getShape( out ), getOrder( out ) );
413417
}
414418
if ( !contains( this._idtypes, pdt ) ) {
415419
throw new TypeError( 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 ) {
418422
if ( !contains( this._odtypes, odt ) ) {
419423
throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( this._odtypes, '", "' ), odt ) );
420424
}
421-
// Fill the output array with pseudorandom numbers:
425+
// Fill the output array with pseudorandom values:
422426
unary( [ p1, out ], this._prng );
423427

424428
return out;

lib/node_modules/@stdlib/random/tools/unary/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stdlib/random/tools/unary",
33
"version": "0.0.0",
4-
"description": "Constructor for creating ndarrays filled with pseudorandom numbers drawn from a single-parameter probability distribution.",
4+
"description": "Constructor for creating ndarrays filled with pseudorandom values drawn from a unary PRNG.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "The Stdlib Authors",

0 commit comments

Comments
 (0)