Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions lib/node_modules/@stdlib/random/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 lib/node_modules/@stdlib/random/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>
Loading