Sha256: 92bf156e5a398c8a1156b88c6c7c083defd509b4aca807d9e2e9bd2d2e742927
Contents?: true
Size: 363 Bytes
Versions: 273
Compression:
Stored size: 363 Bytes
Contents
var baseRandom = require('./_baseRandom'); /** * A specialized version of `_.sample` for arrays. * * @private * @param {Array} array The array to sample. * @returns {*} Returns the random element. */ function arraySample(array) { var length = array.length; return length ? array[baseRandom(0, length - 1)] : undefined; } module.exports = arraySample;
Version data entries
273 entries across 271 versions & 29 rubygems