Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "assert/is-unity-probability-array/docs/types/index.d"

Index

Functions

Export assignment isUnityProbabilityArray

  • isUnityProbabilityArray(v: any): boolean
  • Tests if a value is an array of probabilities that sum to one.

    Parameters

    • v: any

      value to test

    Returns boolean

    boolean indicating if a value is a probability array

    Example

    var bool = isUnityProbabilityArray( [ 0.25, 0.5, 0.25 ] );
    // returns true

    Example

    var bool = isUnityProbabilityArray( new Uint8Array( [ 0, 1 ] ) );
    // returns true

    Example

    var bool = isUnityProbabilityArray( [ 0.4, 0.4, 0.4 ] );
    // returns false

    Example

    var bool = isUnityProbabilityArray( [ 3.14, 0.0 ] );
    // returns false