const sample = (arr: number[]) => arr[Math.floor(Math.random() * arr.length)];
      
      Typescript language logo

      Random element from array

      Codiga's TypeScript Recipes

      Gets a random element from an array.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.