Sha256: 6017bc2ec5223a7bef78001f95ab1827e0ea0003ab3b5c0166e1124d6a68f0ac
Contents?: true
Size: 421 Bytes
Versions: 69
Compression:
Stored size: 421 Bytes
Contents
var randInt = require('./randInt'); var isArray = require('../lang/isArray'); /** * Returns a random element from the supplied arguments * or from the array (if single argument is an array). */ function choice(items) { var target = (arguments.length === 1 && isArray(items))? items : arguments; return target[ randInt(0, target.length - 1) ]; } module.exports = choice;
Version data entries
69 entries across 69 versions & 2 rubygems