diff --git a/lib/node_modules/@stdlib/random/array/tools/README.md b/lib/node_modules/@stdlib/random/array/tools/README.md index 5fc3513d0e41..01fcc20d6d21 100644 --- a/lib/node_modules/@stdlib/random/array/tools/README.md +++ b/lib/node_modules/@stdlib/random/array/tools/README.md @@ -65,15 +65,31 @@ The namespace contains the following: ## Examples - - ```javascript -var objectKeys = require( '@stdlib/utils/keys' ); +var exponential = require( '@stdlib/random/base/exponential' ); +var arcsine = require( '@stdlib/random/base/arcsine' ); +var randn = require( '@stdlib/random/base/improved-ziggurat' ); var ns = require( '@stdlib/random/array/tools' ); -console.log( objectKeys( ns ) ); +// Create a binary PRNG array: +var dtypes = [ 'float64', 'float32', 'generic' ]; +var defaultDType = 'float64'; + +var rand = new ns.binary( arcsine, dtypes, defaultDType ); +var x = rand.generate( 10, 2.0, 5.0 ); +// e.g., returns [ ~3.65, ~4.34, ~3.52, ~4.68, ~2.62, ... ] + +// Create a unary PRNG array: +rand = new ns.unary( exponential, dtypes, defaultDType ); +x = rand.generate( 10, 0.5 ); +// e.g., returns [ ~0.22, ~2.89, ~0.69, ~2.48, ~0.82, ... ] + +// Create a nullary PRNG array: +rand = new ns.nullary( randn, dtypes, defaultDType ); +x = rand.generate( 10 ); +// e.g., returns [ ~-0.22, ~1.89, ~-0.69, ~0.48, ~-0.82, ... ] ``` diff --git a/lib/node_modules/@stdlib/random/array/tools/examples/index.js b/lib/node_modules/@stdlib/random/array/tools/examples/index.js index 6115ca0836c8..a97bcc46b4a6 100644 --- a/lib/node_modules/@stdlib/random/array/tools/examples/index.js +++ b/lib/node_modules/@stdlib/random/array/tools/examples/index.js @@ -18,7 +18,28 @@ 'use strict'; -var objectKeys = require( '@stdlib/utils/keys' ); +var exponential = require( '@stdlib/random/base/exponential' ); +var arcsine = require( '@stdlib/random/base/arcsine' ); +var randn = require( '@stdlib/random/base/improved-ziggurat' ); var ns = require( './../lib' ); -console.log( objectKeys( ns ) ); +// Create a binary PRNG array: +var dtypes = [ 'float64', 'float32', 'generic' ]; +var defaultDType = 'float64'; + +var rand = new ns.binary( arcsine, dtypes, defaultDType ); +var x = rand.generate( 10, 2.0, 5.0 ); +console.log( x ); +// e.g., => [ ~3.65, ~4.34, ~3.52, ~4.68, ~2.62, ... ] + +// Create a unary PRNG array: +rand = new ns.unary( exponential, dtypes, defaultDType ); +x = rand.generate( 10, 0.5 ); +console.log( x ); +// e.g., => [ ~0.22, ~2.89, ~0.69, ~2.48, ~0.82, ... ] + +// Create a nullary PRNG array: +rand = new ns.nullary( randn, dtypes, defaultDType ); +x = rand.generate( 10 ); +console.log( x ); +// e.g., => [ ~-0.22, ~1.89, ~-0.69, ~0.48, ~-0.82, ... ]