ixfx
    Preparing search index...

    Function randomElement

    • Returns random element.

      import { Arrays } from 'https://unpkg.com/ixfx/dist/data.js';

      const v = [`blue`, `red`, `orange`];
      Arrays.randomElement(v); // Yields `blue`, `red` or `orange`

      Use randomIndex if you want a random index within array.

      Type Parameters

      • V

      Parameters

      • array: ArrayLike<V>
      • rand: RandomSource = Math.random

        Random generator. Math.random by default.

      Returns V