sample
sample<
T>(items,k):T[]
Defined in: src/global/collections.ts:92
k distinct elements, in random order.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”Collection<T>
number
Returns
Section titled “Returns”T[]
Example
Section titled “Example”sample([1, 2, 3, 4, 5], 3); // [ 4, 1, 5 ]