NDProb

Namespace

NDProb

Description:
  • NDArray Probability & Random Module Uses Cryptographically Strong Pseudo-Random Number Generator (CSPRNG). All functions return a new NDArray instance.

Source:

Methods

(static) bernoulli(shape, popt, dtypeopt) → {NDArray}

Description:
  • Bernoulli distribution (0 or 1 with probability p).

Source:
Parameters:
Name Type Attributes Default Description
shape Array
p number <optional>
0.5

Probability of success (1).

dtype string <optional>
'int32'
Returns:
Type
NDArray

(static) exponential(shape, lambdaopt) → {NDArray}

Description:
  • Exponential distribution: f(x; λ) = λe^(-λx). Inverse transform sampling: x = -ln(1-u) / λ.

Source:
Parameters:
Name Type Attributes Default Description
shape Array
lambda number <optional>
1.0

Rate parameter.

Returns:
Type
NDArray

(static) normal(shape, meanopt, stdopt, dtypeopt) → {NDArray}

Description:
  • Normal (Gaussian) distribution using Box-Muller transform.

Source:
Parameters:
Name Type Attributes Default Description
shape Array

Dimensions of the output array.

mean number <optional>
0

Mean of the distribution.

std number <optional>
1

Standard deviation.

dtype string <optional>
'float64'

Data type.

Returns:
Type
NDArray

(static) poisson(shape, lambdaopt) → {NDArray}

Description:
  • Poisson distribution using Knuth's algorithm. Note: For very large lambda, this becomes slow; but for most use cases it's fine.

Source:
Parameters:
Name Type Attributes Default Description
shape Array
lambda number <optional>
1.0

Mean of the distribution.

Returns:
Type
NDArray

(static) random(shape, lowopt, highopt, dtypeopt) → {NDArray}

Description:
  • Uniform distribution over [low, high).

Source:
Parameters:
Name Type Attributes Default Description
shape Array

Dimensions of the output array.

low number <optional>
0

Lower boundary.

high number <optional>
1

Upper boundary.

dtype string <optional>
'float64'

Data type.

Returns:
Type
NDArray