Array
Pseudorandom number generator (PRNG) array creation functions.
Usage
var ns = require( '@stdlib/random/array' );
ns
Namespace containing array creation pseudorandom number generator (PRNG) functions.
var o = ns;
// returns {...}
The namespace contains the following:
arcsine( len, a, b[, options] )
: create an array containing pseudorandom numbers drawn from an arcsine distribution.bernoulli( len, p[, options] )
: create an array containing pseudorandom numbers drawn from a Bernoulli distribution.beta( len, alpha, beta[, options] )
: create an array containing pseudorandom numbers drawn from a beta distribution.betaprime( len, alpha, beta[, options] )
: create an array containing pseudorandom numbers drawn from a beta prime distribution.binomial( len, n, p[, options] )
: create an array containing pseudorandom numbers drawn from a binomial distribution.cauchy( len, x0, gamma[, options] )
: create an array containing pseudorandom numbers drawn from a Cauchy distribution.chi( len, k[, options] )
: create an array containing pseudorandom numbers drawn from a chi distribution.chisquare( len, k[, options] )
: create an array containing pseudorandom numbers drawn from a chi-square distribution.cosine( len, mu, s[, options] )
: create an array containing pseudorandom numbers drawn from a raised cosine distribution.discreteUniform( len, a, b[, options] )
: create an array containing pseudorandom numbers drawn from a discrete uniform distribution.erlang( len, k, lambda[, options] )
: create an array containing pseudorandom numbers drawn from an Erlang distribution.exponential( len, lambda[, options] )
: create an array containing pseudorandom numbers drawn from an exponential distribution.f( len, d1, d2[, options] )
: create an array containing pseudorandom numbers drawn from an F distribution.frechet( len, alpha, s, m[, options] )
: create an array containing pseudorandom numbers drawn from a Fréchet distribution.gamma( len, alpha, beta[, options] )
: create an array containing pseudorandom numbers drawn from a gamma distribution.geometric( len, p[, options] )
: create an array containing pseudorandom numbers drawn from a geometric distribution.gumbel( len, mu, beta[, options] )
: create an array containing pseudorandom numbers drawn from a Gumbel distribution.hypergeometric( len, N, K, n[, options] )
: create an array containing pseudorandom numbers drawn from a hypergeometric distribution.invgamma( len, alpha, beta[, options] )
: create an array containing pseudorandom numbers drawn from a inverse gamma distribution.kumaraswamy( len, a, b[, options] )
: create an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.laplace( len, mu, b[, options] )
: create an array containing pseudorandom numbers drawn from a Laplace (double exponential) distribution.levy( len, mu, c[, options] )
: create an array containing pseudorandom numbers drawn from a Lévy distribution.logistic( len, mu, s[, options] )
: create an array containing pseudorandom numbers drawn from a logistic distribution.lognormal( len, mu, sigma[, options] )
: create an array containing pseudorandom numbers drawn from a lognormal distribution.minstdShuffle( len[, options] )
: create an array containing pseudorandom numbers generated using a linear congruential pseudorandom number generator (LCG) whose output is shuffled.minstd( len[, options] )
: create an array containing pseudorandom numbers generated using a linear congruential pseudorandom number generator (LCG).mt19937( len[, options] )
: create an array containing pseudorandom numbers generated using a 32-bit Mersenne Twister pseudorandom number generator.negativeBinomial( len, r, p[, options] )
: create an array containing pseudorandom numbers drawn from a negative binomial distribution.normal( len, mu, sigma[, options] )
: create an array containing pseudorandom numbers drawn from a normal distribution.pareto1( len, alpha, beta[, options] )
: create an array containing pseudorandom numbers drawn from a Pareto (Type I) distribution.poisson( len, lambda[, options] )
: create an array containing pseudorandom numbers drawn from a Poisson distribution.randu( len[, options] )
: create an array containing uniformly distributed pseudorandom numbers between0
and1
.rayleigh( len, sigma[, options] )
: create an array containing pseudorandom numbers drawn from a Rayleigh distribution.t( len, v[, options] )
: create an array containing pseudorandom numbers drawn from a Student's t-distribution.triangular( len, a, b, c[, options] )
: create an array containing pseudorandom numbers drawn from a triangular distribution.uniform( len, a, b[, options] )
: create an array containing pseudorandom numbers drawn from a continuous uniform distribution.weibull( len, k, lambda[, options] )
: create an array containing pseudorandom numbers drawn from a Weibull distribution.
Examples
var ns = require( '@stdlib/random/array' );
// 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>