Chalkboard - v3.0.4
    Preparing search index...

    Function expected

    • Calculates the expected value of an array.

      Parameters

      • arr: number[]

        The array

      • Optionalprobabilities: number[]

        The probabilities of the corresponding elements of the array (optional, defaults to equiprobable)

      Returns number

      const result = Chalkboard.stat.expected([0, 1, 2], [0.25, 0.5, 0.25]); // Returns 1