diff --git a/lib/node_modules/@stdlib/random/strided/tools/README.md b/lib/node_modules/@stdlib/random/strided/tools/README.md index ca598042095..f3fca1be255 100644 --- a/lib/node_modules/@stdlib/random/strided/tools/README.md +++ b/lib/node_modules/@stdlib/random/strided/tools/README.md @@ -66,10 +66,52 @@ The namespace contains the following: ```javascript -var objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( '@stdlib/random/strided/tools' ); - -console.log( objectKeys( ns ) ); +var tools = require( '@stdlib/random/strided/tools' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var normal = require( '@stdlib/random/base/normal' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var filled = require( '@stdlib/array/filled' ); +var zeros = require( '@stdlib/array/zeros' ); +var array = require( '@stdlib/ndarray/array' ); + +// Create PRNG factories +var uniformFactory = tools.unaryFactory( uniform ); +var normalFactory = tools.binaryFactory( normal ); +var bernoulliFactory = tools.unaryFactory( bernoulli ); + +// Create uniform PRNG for filling strided arrays +var uniformFill = uniformFactory( -5.0, 5.0 ); + +// Create normal PRNG for filling strided arrays +var normalFill = normalFactory( 0.0, 1.0 ); + +// Create Bernoulli PRNG for filling strided arrays +var bernoulliFill = bernoulliFactory( 0.5 ); + +// Create arrays to fill +var x = zeros( 10 ); +var y = filled( null, 10 ); +var z = array( new Float64Array( 10 ), { + 'dtype': 'float64' +}); + +// Fill arrays with random values +uniformFill( x.length, x, 1 ); +normalFill( y.length, y, 1 ); +bernoulliFill( z.data.length, z.data, 1 ); + +console.log( 'Uniform (-5, 5):' ); +console.log( x ); +console.log( '\nNormal (0, 1):' ); +console.log( y ); +console.log( '\nBernoulli (p=0.5):' ); +console.log( z.data ); + +// Demonstrate stride manipulation +var w = zeros( 20 ); +uniformFill( 5, w, 4 ); +console.log( '\nUniform with stride 4:' ); +console.log( w ); ```