https://github.com/gaetanlegac/array-pick-random
Pick a number of unique items from a given array (without using array.sort)
https://github.com/gaetanlegac/array-pick-random
array items javascript list pick picker random typescript unique
Last synced: 7 months ago
JSON representation
Pick a number of unique items from a given array (without using array.sort)
- Host: GitHub
- URL: https://github.com/gaetanlegac/array-pick-random
- Owner: gaetanlegac
- Created: 2021-09-02T06:00:45.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-02T06:14:53.000Z (about 4 years ago)
- Last Synced: 2025-02-16T20:01:41.665Z (8 months ago)
- Topics: array, items, javascript, list, pick, picker, random, typescript, unique
- Language: TypeScript
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Array Pick Random
Pick a number of unique items from a given array (without using array.sort)
[](https://www.npmjs.com/package/array-pick-random)
## Installation
```bash
npm install --save array-pick-random
```## Usage
```typescript
array_pick_random( array: any[], itemsCount: number ): any[];
```## Usage example
```typescript
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 ]
);
```