Generate random numbers. This provides a single object that can be passed around to generate numbers from all distributions supported by the package, as well as the state required to generate the numbers from.

Hierarchy

  • Random

Constructors

  • An initialised random number state

    Parameters

    Returns Random

Properties

state: RngState

The internal random number state, which is updated by calls to any of the distribution functions.

Methods

  • binomial(n: number, p: number): number
  • Generate a binomially distributed random number (binomial)

    Parameters

    • n: number

      number of trials

    • p: number

      per-traial probability of success

    Returns number

  • exponential(rate: number): number
  • Generate an exponentially distributed random number (exponential)

    Parameters

    • rate: number

      The rate of the process

    Returns number

  • normal(mean: number, sd: number): number
  • Generate an normally distributed random number (normal)

    Parameters

    • mean: number

      The mean of the distribution

    • sd: number

      The standard deviation of the distribution

    Returns number

  • poisson(lambda: number): number
  • Generate a Poisson distributed random number (poisson)

    Parameters

    • lambda: number

      The mean of the distribution

    Returns number

  • randomExponential(): number
  • Generate a standard exponential random number Exponential(1) (randomExponential)

    Returns number

  • randomNormal(): number
  • Generate a standard normal random number N(0, 1) (randomNormal)

    Returns number

  • randomUniform(): number
  • Generate a standard uniform random number U(0, 1) (randomUniform)

    Returns number

  • uniform(min: number, max: number): number
  • Generate a uniformly distributed random number (uniform)

    Parameters

    • min: number

      Minimum value of the distribution

    • max: number

      Max value of the distribution

    Returns number

Generated using TypeDoc