Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Sep 7, 2024
1 parent 597898b commit a3854b4
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@

### Contributors

A total of 2 people contributed to this release. Thank you to the following contributors:
A total of 3 people contributed to this release. Thank you to the following contributors:

- Jenish Thapa
- Philipp Burckhardt
- Tirtadwipa Manunggal

</section>

Expand All @@ -33,6 +34,7 @@ A total of 2 people contributed to this release. Thank you to the following cont

<details>

- [`62bb1e0`](https://github.com/stdlib-js/stdlib/commit/62bb1e0759f54abf61b84bb48ebf74a97128f779) - **docs:** improve examples of `random/array` namespace _(by Tirtadwipa Manunggal, Philipp Burckhardt)_
- [`8e110d6`](https://github.com/stdlib-js/stdlib/commit/8e110d608afcc21dd633b7f1939f92ef7f3085e1) - **docs:** update examples for `random/array/tools` _(by Jenish Thapa, Philipp Burckhardt)_

</details>
Expand Down
39 changes: 35 additions & 4 deletions array/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,46 @@ The namespace contains the following:

## Examples

<!-- TODO: better examples -->

<!-- eslint no-undef: "error" -->

```javascript
var objectKeys = require( '@stdlib/utils/keys' );
var ns = require( '@stdlib/random/array' );

console.log( objectKeys( ns ) );
// Generate arrays with ten random numbers drawn from the respective distributions:
var out = ns.arcsine( 10, 2.0, 5.0 );
// returns <Float64Array>

out = ns.weibull( 10, 2.0, 5.0 );
// returns <Float64Array>

out = ns.laplace( 10, 2.0, 5.0 );
// returns <Float64Array>

// Factory methods:

// 1. Basic factory usage (no parameters):
var random = ns.arcsine.factory();
out = random( 10, 2.0, 5.0 );
// returns <Float64Array>

// 2. Factory with options (e.g., seed):
random = ns.arcsine.factory({
'seed': 1234
});
out = random( 10, 2.0, 5.0 );
// returns <Float64Array>

// 3. Factory with distribution parameters:
random = ns.arcsine.factory( 2.0, 5.0 );
out = random( 10 );
// returns <Float64Array>

// 4. Factory with both distribution parameters and options:
random = ns.arcsine.factory( 2.0, 5.0, {
'dtype': 'float32'
});
out = random( 10 );
// returns <Float32Array>
```

</section>
Expand Down
44 changes: 42 additions & 2 deletions array/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,47 @@

'use strict';

var objectKeys = require( '@stdlib/utils/keys' );
var ns = require( './../lib' );

console.log( objectKeys( ns ) );
// Generate arrays with ten random numbers drawn from the respective distributions:
var out = ns.arcsine( 10, 2.0, 5.0 );
console.log( out );
// => <Float64Array>

out = ns.weibull( 10, 2.0, 5.0 );
console.log( out );
// => <Float64Array>

out = ns.laplace( 10, 2.0, 5.0 );
console.log( out );
// => <Float64Array>

// Factory methods:

// 1. Basic factory usage (no parameters):
var random = ns.arcsine.factory();
out = random( 10, 2.0, 5.0 );
console.log( out );
// => <Float64Array>

// 2. Factory with options (e.g., seed):
random = ns.arcsine.factory({
'seed': 1234
});
out = random( 10, 2.0, 5.0 );
console.log( out );
// => <Float64Array>

// 3. Factory with distribution parameters:
random = ns.arcsine.factory( 2.0, 5.0 );
out = random( 10 );
console.log( out );
// => <Float64Array>

// 4. Factory with both distribution parameters and options:
random = ns.arcsine.factory( 2.0, 5.0, {
'dtype': 'float32'
});
out = random( 10 );
console.log( out );
// => <Float32Array>

0 comments on commit a3854b4

Please sign in to comment.