Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Distribution

Hierarchy

  • Distribution

Index

Constructors

Properties

_engine: Random

Accessors

  • get seed(): number | number[]
  • get uses(): number

Methods

  • Adds a key / value pair to a Distribution. Will add to the source distribution by default, unless the distribution only has normalized values.

    Parameters

    • key: string

      Key to be added.

    • value: number

      Value of the key to add.

    Returns Distribution

  • pick(count?: number, mask?: string[], exclusive?: boolean): string[]
  • Picks one more values from a Distribution without exclusion. If you just need to pick one value, you should use pickOne instead.

    Parameters

    • count: number = 1

      The number of picks to make (default 1).

    • Optional mask: string[]

      A mask containing keys in the distribution that should be ignored.

    • exclusive: boolean = false

      If true picks are considered exclusive and are removed.

    Returns string[]

  • pickOne(mask?: string[]): undefined | string
  • Picks a single value from a Distribution. If you are picking multiple values, use pick instead.

    Parameters

    • Optional mask: string[]

      A mask containing keys in the distribution that should be ignored.

    Returns undefined | string

  • Adds a key / value pair to a Distribution. Will add to the source distribution by default, unless the distribution only has normalized values.

    Parameters

    • model: DistributionDTO

      A Distribution data transfer object.

    • key: string

      Key to be added.

    • value: number

      Value of the key to add.

    Returns DistributionDTO

  • Adds a key / value pair to a normal distribution and renormalizes it. If a source distribution exists, it will be recalculated based off of the new normal distribution.

    Parameters

    • model: DistributionDTO

      A Distribution data transfer object.

    • key: string

      Key to be added.

    • value: number

      Value of the key to add.

    Returns DistributionDTO

  • Adds a key / value pair to a distribution's source and renormalizes it. If a source distribution exists, it will be recalculated based off of the new normal distribution.

    Parameters

    • model: DistributionSourceDTO

      A Distribution data transfer object.

    • key: string

      Key to be added.

    • value: number

      Value of the key to add.

    Returns DistributionSourceDTO

  • Picks one more values from a Distribution without exclusion. If you just need to pick one value, you should use pickOne instead.

    Parameters

    • model: DistributionNormalDTO

      A Distribution data transfer object.

    • count: number = 1

      The number of picks to make (default 1).

    • Optional mask: string[]

      A mask containing keys in the distribution that should be ignored.

    • exclusive: boolean = false

      If true picks are considered exclusive and are removed.

    • Optional engine: Random

      A Random engine. This is created if not provided.

    Returns string[]

  • Picks a single value from a Distribution. If you are picking multiple values, use pick instead.

    Parameters

    • model: DistributionNormalDTO

      A Distribution data transfer object.

    • Optional mask: string[]

      A mask containing keys in the distribution that should be ignored.

    • Optional engine: Random

      A Random engine. This is created if not provided.

    Returns undefined | string

Generated using TypeDoc