naginterfaces.library.rand.logical

naginterfaces.library.rand.logical(n, p, statecomm)[source]

logical generates a vector of pseudorandom logical values – with probability and with probability .

For full information please refer to the NAG Library document for g05tb

https://support.nag.com/numeric/nl/nagdoc_30/flhtml/g05/g05tbf.html

Parameters
nint

, the number of pseudorandom logical values to be generated.

pfloat

Must contain the probability of logical returning .

statecommdict, RNG communication object, modified in place

RNG communication structure.

This argument must have been initialized by a prior call to init_repeat() or init_nonrepeat().

Returns
xbool, ndarray, shape

The logical values.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, [‘state’] vector has been corrupted or not initialized.

Notes

logical generates logical values from the relation

where is a pseudorandom number from a uniform distribution over , generated by dist_uniform01() using the values of [‘state’] as input to this function.

One of the initialization functions init_repeat() (for a repeatable sequence if computed sequentially) or init_nonrepeat() (for a non-repeatable sequence) must be called prior to the first call to logical.

References

Knuth, D E, 1981, The Art of Computer Programming (Volume 2), (2nd Edition), Addison–Wesley