You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
394 B
21 lines
394 B
4 weeks ago
|
# pickset
|
||
|
|
||
|
```js
|
||
|
// usage
|
||
|
chance.pickset(array, quantity)
|
||
|
```
|
||
|
|
||
|
Given an array, pick some random elements and return them in a new array
|
||
|
|
||
|
```js
|
||
|
chance.pickset(['alpha', 'bravo', 'charlie', 'delta', 'echo'], 3);
|
||
|
=> ['echo', 'alpha', 'bravo']
|
||
|
```
|
||
|
|
||
|
Optionally omit the quantity to retrieve a set with length 1
|
||
|
|
||
|
```js
|
||
|
chance.pickset(['alpha', 'bravo', 'charlie', 'delta', 'echo']);
|
||
|
=> ['delta']
|
||
|
```
|