graycoreio/daffodil

View on GitHub
libs/core/src/utils/sample.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { randomSlice } from './random-slice';

/**
 * Returns a random element of an array.
 */
export const sample = <T>(array: T[]): T => randomSlice(array, 1)[0];