# Arcsine Random Numbers

Arcsine distributed pseudorandom numbers.

## Usage

``````var arcsine = require( '@stdlib/random/base/arcsine' );
``````

#### arcsine( a, b )

Returns a pseudorandom number drawn from an arcsine distribution with parameters `a` (minimum support) and `b` (maximum support).

``````var r = arcsine( 2.0, 5.0 );
// returns <number>
``````

If either `a` or `b` is `NaN` or `a >= b`, the function returns `NaN`.

``````var r = arcsine( 2.0, 1.0 );
// returns NaN

r = arcsine( NaN, 1.0 );
// returns NaN

r = arcsine( 1.0, NaN );
// returns NaN
``````

#### arcsine.factory( [a, b, ][options] )

Returns a pseudorandom number generator (PRNG) for generating pseudorandom numbers drawn from an arcsine distribution.

``````var rand = arcsine.factory();

var r = rand( 0.0, 1.0 );
// returns <number>
``````

If provided `a` and `b`, the returned generator returns random variates from the specified distribution.

``````// Draw from arcsine( -2.0, 2.0 ) distribution:
var rand = arcsine.factory( -2.0, 2.0 );

var r = rand();
// returns <number>

r = rand();
// returns <number>
``````

If not provided `a` and `b`, the returned generator requires that both parameters be provided at each invocation.

``````var rand = arcsine.factory();

var r = rand( 0.0, 1.0 );
// returns <number>

r = rand( -2.0, 2.0 );
// returns <number>
``````

The function accepts the following `options`:

• seed: pseudorandom number generator seed.

To seed a pseudorandom number generator, set the `seed` option.

``````var rand = arcsine.factory({
'seed': 12345
});

var r = rand( 2.0, 4.0 );
// returns ~3.971

rand = arcsine.factory( 2.0, 4.0, {
'seed': 12345
});

r = rand();
// returns ~3.971
``````

#### arcsine.NAME

The generator name.

``````var str = arcsine.NAME;
// returns 'arcsine'
``````

#### arcsine.PRNG

The underlying pseudorandom number generator.

``````var prng = arcsine.PRNG;
// returns <Function>
``````

#### arcsine.SEED

The value used to seed `arcsine()`.

``````var rand;
var r;
var i;

// Generate pseudorandom values...
for ( i = 0; i < 100; i++ ) {
r = arcsine( 0.0, 10.0 );
}

// Generate the same pseudorandom values...
rand = arcsine.factory( 0.0, 10.0, {
'seed': arcsine.SEED
});
for ( i = 0; i < 100; i++ ) {
r = rand();
}
``````

## Examples

``````var arcsine = require( '@stdlib/random/base/arcsine' );

var seed;
var rand;
var i;

// Generate pseudorandom numbers...
console.log( '\nseed: %d', arcsine.SEED );
for ( i = 0; i < 100; i++ ) {
console.log( arcsine( 0.0, 1.0 ) );
}

// Create a new pseudorandom number generator...
seed = 1234;
rand = arcsine.factory( 2.0, 5.0, {
'seed': seed
});
console.log( '\nseed: %d', seed );
for ( i = 0; i < 100; i++ ) {
console.log( rand() );
}

// Create another pseudorandom number generator using a previous seed...
rand = arcsine.factory( 0.0, 1.0, {
'seed': arcsine.SEED
});
console.log( '\nseed: %d', arcsine.SEED );
for ( i = 0; i < 100; i++ ) {
console.log( rand() );
}
``````