npm.nicfv.com
    Preparing search index...

    Function selectRandom

    • Select a single item from an array at random with uniform weights.

      Type Parameters

      • T

      Parameters

      • stack: T[]

        An array of arbirary item

      Returns T

      A single randomly selected item

      const selected = SMath.selectRandom([10, 20, 30, 40]); // 30