sampleSize (Functional Programming) es-toolkit
Creates a function that returns random values from an array. Use it with pipe.
Info
Prefer the original es-toolkit sampleSize in ordinary code. Use this fp variant when composing transformations with pipe.
Usage
sampleSize returns size random values from the piped array without repeating the same array position.
Parameters
sizenumberrequired
The number of random values to return.
Returns
A function that maps a readonly T[] to random values.
Throws
Throws an error if size is greater than the length of the piped array.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.