Truncate an array.
@param {bitArray} a The array.
@param {Number} len The length to truncate to, in bits.
@return {bitArray} A new array, truncated to len bits.
428510
function (a, len) {
    if (a.length * 32 < len) { return a; }
    a = a.slice(0, Math.ceil(len / 32));
    var l = a.length;
    len = len & 31;
    if (l > 0 && len) {
      a[l-1] = sjcl.bitArray.partial(len, a[l-1] & 0x80000000 >> (len-1), 1);
    }
    return a;
  }
511323
function slice(args) {
  var l = args.length, a = [], i
  for (i = 0; i < l; i++) a[i] = args[i]
  return a
}
1129758
function drop (n, array) {
  return (n < array.length)
    ? slice(n, array.length, array)
    : []
}
690290
@SafeVarargs
    public static long[] removeAll(final long[] a, final long... elements) {
        if (N.isNullOrEmpty(a)) {
            return N.EMPTY_LONG_ARRAY;
        } else if (N.isNullOrEmpty(elements)) {
            return a.clone();
        } else if (elements.length == 1) {
            return removeAllOccurrences(a, elements[0]);
        }

        final LongList list = LongList.of(a.clone());
        list.removeAll(LongList.of(elements));
        return list.trimToSize().array();
    }
1037248
def _truncate(value, arg):
        
        length = int(arg)
        if value is None:
            value = ""
        if len(value) > length:
            return value[:length] + "..."
        else:
            return value
618633
function dereplicate( array ) {
    var a = {};
    var b = [];
    for ( var i = 0, len = array.length; i < len; ++i ) {
      if ( a[ array[i] ] !== true ) {
        a[ array[i] ] = true;
        b.push( array[i] );
      }
    }
    return b;
  }
631280
function flatten(a) {
  function _reduce(a) { return a.reduce(_flatten, []); }

  function _flatten(a, b) {
    return a.concat(Array.isArray(b) ? _reduce(b) : b);
  }

  return _reduce(a);
}
587238
public static long[] truncateI(long[] v, int len) {
    final int zap = (v.length * Long.SIZE) - len;
    final int zapWords = (zap >>> LONG_LOG2_SIZE);
    final int zapbits = zap & LONG_LOG2_MASK;
    Arrays.fill(v, v.length - zapWords, v.length, 0);
    if(zapbits > 0) {
      v[v.length - zapWords - 1] &= (LONG_ALL_BITS >>> zapbits);
    }
    return v;
  }
687482
def _truncate(self, x, k):
        '''  '''
        not_F = np.argsort(np.abs(x))[:-k]
        x[not_F] = 0
        return x
678838
public void truncateZeros( double tol ) {

//		double max = 0;
//		for( int i = 0; i < size; i++ ) {
//			double d = Math.abs(c[i]);
//			if( d > max )
//				max = d;
//		}
//
//		tol *= max;

		int i = size-1;

		for( ; i >= 0; i-- ) {
			if( Math.abs(c[i]) > tol )
				break;
		}
		size = i+1;
	}
630615
function slice (args, start, end) {
  var len = args.length;
  start = start > 0 ? start : 0;
  end = end >= 0 && end < len ? end : len;

  var n = end - start;
  if (n <= 0) return [];

  var ret = new Array(n);
  for (var i = 0; i < n; ++i) {
    ret[i] = args[i + start];
  }
  return ret;
}
1053002
def truncate(data, l=20):
    ""
    info = (data[:l] + '..') if len(data) > l else data
    return info
316183
function(arrayBuffer, sliceSize) {
		var segments= [],
			fi = 0;
		while(fi * sliceSize < arrayBuffer.byteLength){
			segments.push(arrayBuffer.slice(fi * sliceSize, (fi + 1) * sliceSize));
			fi++;
		}
		return segments;
	}
1294873
function random(array, len) {
  const size = array.length;
  const randomIndexes = crypto.randomBytes(len).toJSON().data;
  return randomIndexes.map((char) => array[char % size]).join('');
}
998360
function ones( len ) {
	var out = new Array( len ),
		i;

	for ( i = 0; i < len; i++ ) {
		out[ i ] = 1;
	}
	return out;
}
491163
public static CharSequence truncate(CharSequence s, int len) {
    if (s.length() == len) return (s);
    if (s.length() > len) return (s.subSequence(0, len));
    StringBuilder result = new StringBuilder(s);
    while (result.length() < len)
      result.append(' ');
    return (result);
  }
613546
function bitArrayToArray(bitArray) {
    let resultArray = [];
    for (let index = 0; index < bitArray.byteLength; index++) {
        let arrayByte = bitArray.readUInt8(index);
        // Skip bit operations if zero -> no bit is set
        if (arrayByte !== 0) {
            for (let bitIndex = 0; bitIndex < 8; bitIndex++) {
                if ((arrayByte & 0x01) === 0x01) {
                    resultArray.push(index * 8 + bitIndex);
                }
                arrayByte = arrayByte >>> 1;
            }
        }
    }
    return resultArray;
}