whole_func_string: function sample(collection, n, guard) {
        var length = collection ? collection.length : 0;
        if (typeof length != 'number') {
          collection = values(collection);
        }
        if (n == null || guard) {
          return collection ? collection[random(length - 1)] : undefined;
        }
        var result = shuffle(collection);
        result.length = nativeMin(nativeMax(0, n), result.length);
        return result;
      }
func_code_string: function sample(collection, n, guard) {
        var length = collection ? collection.length : 0;
        if (typeof length != 'number') {
          collection = values(collection);
        }
        if (n == null || guard) {
          return collection ? collection[random(length - 1)] : undefined;
        }
        var result = shuffle(collection);
        result.length = nativeMin(nativeMax(0, n), result.length);
        return result;
      }
func_documentation_string: 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] Allows working with functions, like `_.map`,
  without using their `key` and `object` arguments as sources.
  @returns {Array} Returns the random sample(s) of `collection`.
  @example
  
  _.sample([1, 2, 3, 4]);
  // => 2
  
  _.sample([1, 2, 3, 4], 2);
  // => [3, 1]