Skip to content

Pick a number of unique items from a given array (without using array.sort)

Notifications You must be signed in to change notification settings

gaetanlegac/array-pick-random

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Array Pick Random

Pick a number of unique items from a given array (without using array.sort)

npm

Installation

npm install --save array-pick-random

Usage

array_pick_random( array: any[], itemsCount: number ): any[];

Usage example

import array_pick_random from 'array-pick-random';

console.log(
    array_pick_random([ 1,2,3,4,5,6,7,8,9 ], 3),
    // Returns [ 6, 1, 4 ]
);

About

Pick a number of unique items from a given array (without using array.sort)

Topics

Resources

Stars

Watchers

Forks