public/build/static/application.js
function sample(collection, n, guard) {
      if (collection && typeof collection.length != 'number') {
        collection = values(collection);
      } else if (support.unindexedChars && isString(collection)) {
        collection = collection.split('');
      }
      if (n == null || guard) {
        return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;
      }
      var result = shuffle(collection);
      result.length = nativeMin(nativeMax(0, n), result.length);
      return result;
    }
function sample(collection, n, guard) {
      if (collection && typeof collection.length != 'number') {
        collection = values(collection);
      } else if (support.unindexedChars && isString(collection)) {
        collection = collection.split('');
      }
      if (n == null || guard) {
        return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;
      }
      var result = shuffle(collection);
      result.length = nativeMin(nativeMax(0, n), result.length);
      return result;
    }
function sample ( collection , n , guard ) { if ( collection && typeof collection . length != 'number' ) { collection = values ( collection ) ; } else if ( support . unindexedChars && isString ( collection ) ) { collection = collection . split ( '' ) ; } if ( n == null || guard ) { return collection ? collection [ baseRandom ( 0 , collection . length - 1 ) ] : undefined ; } var result = shuffle ( collection ) ; result . length = nativeMin ( nativeMax ( 0 , n ) , result . length ) ; return result ; }
Retrieves a random element or `n` random elements from a collection.

@static
@memberOf _
@category Collections
@param {Array|Object|string} collection The collection to sample.
@param {number} [n] The number of elements to sample.
@param- {Object} [guard] Enables use as a callback for functions like `_.map`.
@returns {*} Returns the random sample(s) of `collection`.
@example

_.sample([1, 2, 3, 4]);
// => 2

_.sample([1, 2, 3, 4], 2);
// => [3, 1]
Retrieves a random element or n random elements from a collection .