Skip to content

Commit b8db168

Browse files
committed
docs: use attribute accessors in examples
--- 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: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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 67aa7ca commit b8db168

File tree

1 file changed

+11
-4
lines changed
  • lib/node_modules/@stdlib/random/exponential

1 file changed

+11
-4
lines changed

lib/node_modules/@stdlib/random/exponential/README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ The function has the following parameters:
4848
When provided a scalar distribution parameter, every element in the output [ndarray][@stdlib/ndarray/ctor] is drawn from the same distribution. To generate pseudorandom numbers drawn from different distributions, provide a distribution parameter argument as an [ndarray][@stdlib/ndarray/ctor]. The following example demonstrates broadcasting an [ndarray][@stdlib/ndarray/ctor] containing distribution parameters to generate sub-matrices drawn from different distributions.
4949

5050
```javascript
51+
var getShape = require( '@stdlib/ndarray/shape' );
5152
var array = require( '@stdlib/ndarray/array' );
5253

5354
var lambda = array( [ [ [ 2.0 ] ], [ [ 5.0 ] ] ] );
5455
// returns <ndarray>
5556

56-
var shape = lambda.shape;
57+
var shape = getShape( lambda );
5758
// returns [ 2, 1, 1 ]
5859

5960
var arr = exponential( [ 2, 3, 3 ], lambda );
@@ -63,10 +64,12 @@ var arr = exponential( [ 2, 3, 3 ], lambda );
6364
If provided an empty shape, the function returns a zero-dimensional [ndarray][@stdlib/ndarray/ctor].
6465

6566
```javascript
67+
var getShape = require( '@stdlib/ndarray/shape' );
68+
6669
var arr = exponential( [], 2.0 );
6770
// returns <ndarray>
6871

69-
var shape = arr.shape;
72+
var shape = getShape( arr );
7073
// returns []
7174

7275
var v = arr.get();
@@ -84,14 +87,16 @@ The function accepts the following options:
8487
By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
8588

8689
```javascript
90+
var getDType = require( '@stdlib/ndarray/dtype' );
91+
8792
var opts = {
8893
'dtype': 'generic'
8994
};
9095

9196
var arr = exponential( [ 3, 3 ], 2.0, opts );
9297
// returns <ndarray>
9398

94-
var dt = arr.dtype;
99+
var dt = getDType( arr );
95100
// returns 'generic'
96101
```
97102

@@ -122,12 +127,14 @@ The method has the following parameters:
122127
Returns a function for generating pseudorandom numbers drawn from an [exponential][@stdlib/random/base/exponential] distribution.
123128

124129
```javascript
130+
var getShape = require( '@stdlib/ndarray/shape' );
131+
125132
var random = exponential.factory();
126133

127134
var out = random( [ 3, 3 ], 2.0 );
128135
// returns <ndarray>
129136

130-
var sh = out.shape;
137+
var sh = getShape( out );
131138
// returns [ 3, 3 ]
132139
```
133140

0 commit comments

Comments
 (0)