Sha256: f2db4b99340ee5f3420bb01052d36e3c53799c0b4cafde8c9f8731f343eecf63

Contents?: true

Size: 642 Bytes

Versions: 153

Compression:

Stored size: 642 Bytes

Contents

var sample = require('./sample');

/** Used as references for `-Infinity` and `Infinity`. */
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;

/**
 * Creates an array of shuffled values, using a version of the
 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
 *
 * @static
 * @memberOf _
 * @category Collection
 * @param {Array|Object|string} collection The collection to shuffle.
 * @returns {Array} Returns the new shuffled array.
 * @example
 *
 * _.shuffle([1, 2, 3, 4]);
 * // => [4, 1, 3, 2]
 */
function shuffle(collection) {
  return sample(collection, POSITIVE_INFINITY);
}

module.exports = shuffle;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/collection/shuffle.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/collection/shuffle.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/collection/shuffle.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/collection/shuffle.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/collection/shuffle.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/collection/shuffle.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/collection/shuffle.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/collection/shuffle.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/collection/shuffle.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/shuffle.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/collection/shuffle.js