diff --git a/CHANGELOG.md b/CHANGELOG.md index 95663a32..9fe2c742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -33,6 +34,7 @@ A total of 2 people contributed to this release. Thank you to the following cont
+- [`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)_
diff --git a/array/README.md b/array/README.md index 9969abfa..22f2ae11 100644 --- a/array/README.md +++ b/array/README.md @@ -95,15 +95,46 @@ The namespace contains the following: ## Examples - - ```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 + +out = ns.weibull( 10, 2.0, 5.0 ); +// returns + +out = ns.laplace( 10, 2.0, 5.0 ); +// returns + +// Factory methods: + +// 1. Basic factory usage (no parameters): +var random = ns.arcsine.factory(); +out = random( 10, 2.0, 5.0 ); +// returns + +// 2. Factory with options (e.g., seed): +random = ns.arcsine.factory({ + 'seed': 1234 +}); +out = random( 10, 2.0, 5.0 ); +// returns + +// 3. Factory with distribution parameters: +random = ns.arcsine.factory( 2.0, 5.0 ); +out = random( 10 ); +// returns + +// 4. Factory with both distribution parameters and options: +random = ns.arcsine.factory( 2.0, 5.0, { + 'dtype': 'float32' +}); +out = random( 10 ); +// returns ``` diff --git a/array/examples/index.js b/array/examples/index.js index c8760638..f8f172e8 100644 --- a/array/examples/index.js +++ b/array/examples/index.js @@ -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 ); +// => + +out = ns.weibull( 10, 2.0, 5.0 ); +console.log( out ); +// => + +out = ns.laplace( 10, 2.0, 5.0 ); +console.log( out ); +// => + +// Factory methods: + +// 1. Basic factory usage (no parameters): +var random = ns.arcsine.factory(); +out = random( 10, 2.0, 5.0 ); +console.log( out ); +// => + +// 2. Factory with options (e.g., seed): +random = ns.arcsine.factory({ + 'seed': 1234 +}); +out = random( 10, 2.0, 5.0 ); +console.log( out ); +// => + +// 3. Factory with distribution parameters: +random = ns.arcsine.factory( 2.0, 5.0 ); +out = random( 10 ); +console.log( out ); +// => + +// 4. Factory with both distribution parameters and options: +random = ns.arcsine.factory( 2.0, 5.0, { + 'dtype': 'float32' +}); +out = random( 10 ); +console.log( out ); +// =>