Anthony Fuchore: update596f2223 years agoHistory
3 lines · 141 B · TypeScript
RawDownload
export function sample<T>(arr: T[], num: number) {  return Array.from({ length: num }, () => arr[Math.floor(arr.length * Math.random())])}