We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2193288 commit 1106872Copy full SHA for 1106872
src/array.ts
@@ -180,12 +180,13 @@ export function clampArrayRange(n: number, arr: readonly unknown[]) {
180
}
181
182
/**
183
- * Get random items from an array
+ * Get random item(s) from an array
184
*
185
- * @category Array
+ * @param arr
186
+ * @param quantity - quantity of random items which will be returned
187
*/
-export function sample<T>(arr: T[], count: number) {
188
- return Array.from({ length: count }, _ => arr[Math.round(Math.random() * (arr.length - 1))])
+export function sample<T>(arr: T[], quantity: number) {
189
+ return Array.from({ length: quantity }, _ => arr[Math.round(Math.random() * (arr.length - 1))])
190
191
192
0 commit comments