dist/utilify.esm.js
function arraySample(arr, num, remove) {
        var result = [];
        var _num = void 0;
        var _remove = void 0;
        var single = void 0;

        if (validateHelpers.isBoolean(num)) {
            _remove = num;
        } else {
            _num = num;
            _remove = remove;
        }

        if (validateHelpers.isUndefined(_num)) {
            _num = 1;
            single = true;
        }

        if (!_remove) {
            arr = this.arrayClone(arr);
        }

        _num = Math.min(_num, arr.length);

        for (var i = 0, index; i < _num; i += 1) {
            index = Math.trunc(Math.random() * arr.length);
            result.push(arr[index]);
            arr.splice(index, 1);
        }

        return single ? result[0] : result;
    }
function arraySample(arr, num, remove) {
        var result = [];
        var _num = void 0;
        var _remove = void 0;
        var single = void 0;

        if (validateHelpers.isBoolean(num)) {
            _remove = num;
        } else {
            _num = num;
            _remove = remove;
        }

        if (validateHelpers.isUndefined(_num)) {
            _num = 1;
            single = true;
        }

        if (!_remove) {
            arr = this.arrayClone(arr);
        }

        _num = Math.min(_num, arr.length);

        for (var i = 0, index; i < _num; i += 1) {
            index = Math.trunc(Math.random() * arr.length);
            result.push(arr[index]);
            arr.splice(index, 1);
        }

        return single ? result[0] : result;
    }
function arraySample ( arr , num , remove ) { var result = [ ] ; var _num = void 0 ; var _remove = void 0 ; var single = void 0 ; if ( validateHelpers . isBoolean ( num ) ) { _remove = num ; } else { _num = num ; _remove = remove ; } if ( validateHelpers . isUndefined ( _num ) ) { _num = 1 ; single = true ; } if ( ! _remove ) { arr = this . arrayClone ( arr ) ; } _num = Math . min ( _num , arr . length ) ; for ( var i = 0 , index ; i < _num ; i += 1 ) { index = Math . trunc ( Math . random ( ) * arr . length ) ; result . push ( arr [ index ] ) ; arr . splice ( index , 1 ) ; } return single ? result [ 0 ] : result ; }
Returns a random element from the array.
If num is passed, will return an array of num elements.
If remove is true, sampled elements will also be removed from the array.
remove can also be passed in place of num.

@param  {Array} [arr]  Array to sample
@param  {Integer|Boolean} [num=1]    Num of elements
@param  {Boolean} [remove=false]     Remove sampled elements
@return {String|Array}
Returns a random element from the array . If num is passed will return an array of num elements . If remove is true sampled elements will also be removed from the array . remove can also be passed in place of num .