I have a list of numbers Z from 0 to N
    I have a list of J numbers (where J < N) randomly distributed throughout Z
    I wish to remove K numbers from Z, without drawing from any number in J
765565
def remove_outliers(lodol, actually_keep=True):
    bad_indexes = set()
    bad_keys = set()
    DEVIATIONS = 4
    MAX_LENGTH = 10000
    
    for data in lodol:
        #print(data['name'])
        #print([e for e in data['data'] if isinstance(e, (str, unicode))])
        if isinstance(data['data'][0], (int, float)):
            mean = statistics.mean(data['data'])
            std = statistics.stdev(data['data'])
            evils = 0
            for index, value in enumerate(data['data']):
                if mean - DEVIATIONS*std > value or value > mean + DEVIATIONS*std:
                    bad_keys.add(data['name'])
                    bad_indexes.add(index)
                    evils += 1
            print(data['name'], mean-4*std, mean+4*std, evils)
            
    total_indexes = len(lodol[0]['data'])
    reduced_indexes = total_indexes - len(bad_indexes)
    print("Bad indexes:", len(bad_indexes), "/", total_indexes)
    '''
    
    '''
    if reduced_indexes > MAX_LENGTH:
        stride = int(total_indexes / MAX_LENGTH)
        for an_index in range(0, total_indexes, stride):
            keep_index = random.randint(0, stride-1)
            for offset in xrange(0, stride):
                if keep_index != offset:
                    bad_indexes.add(min(total_indexes, an_index+offset))
    if actually_keep:
        bad_indexes = set()
        bad_keys = set()
    print("Trimmed indexes:", len(bad_indexes), "/", total_indexes)
    print("Contributing keys:", ', '.join(bad_keys))
    for data in lodol:
        data['data'] = [v for i, v in enumerate(data['data']) if i not in bad_indexes]
        inter = data['name'].split('.', 2)[2]
        if '.' in inter:
            category, name = inter.rsplit('.', 1)
        else:
            category, name = inter, inter
        category = category.replace('.', ' ')
        data['pretty'] = category.title() + ": "+name.title()
        if isinstance(data['data'][0], (float, int)):
            data['type'] = 'number'
        else:
            data['type'] = 'text'
    lodol.sort(key= lambda e: e['pretty'])
46417
def shuffle(self, random=None):
		""""""
		random_.shuffle(self._list, random=random)
		for i, elem in enumerate(self._list):
			self._dict[elem] = i
1066754
def _remove_n(self):
        ''''''
        for i, result in enumerate(self.results):
            largest = max(str(result).split('N'), key=len)
            start = result.locate(largest)[0][0]
            stop = start + len(largest)
            if start != stop:
                self.results[i] = self.results[i][start:stop]
256633
public void remove(int n) {
    assert this.inHeap(n);
    int kPos = this.indices.get(n);
    this.indices.set(n, -1);
    if (kPos < this.heap.size() - 1) {
      this.heap.set(kPos, this.heap.back());
      this.indices.set(this.heap.get(kPos), kPos);
      this.heap.pop();
      this.percolateDown(kPos);
    } else
      this.heap.pop();
  }
664826
public Matrix removeColumn(int j) {
        if (j >= columns || j < 0) {
            throw new IndexOutOfBoundsException("Illegal column number, must be 0.." + (columns - 1));
        }

        Matrix result = blankOfShape(rows, columns - 1);

        for (int jj = 0; jj < j; jj++) {
            result.setColumn(jj, getColumn(jj));
        }

        for (int jj = j + 1; jj < columns; jj++) {
            result.setColumn(jj - 1, getColumn(jj));
        }

        return result;
    }
1137508
public void removePoint(int index) {
        int numKnots = x.length;
        if (numKnots <= 2)
            return;
        float[] nx = new float[numKnots - 1];
        float[] ny = new float[numKnots - 1];
        int j = 0;
        for (int i = 0; i < numKnots - 1; i++) {
            if (i == index)
                j++;
            nx[i] = x[j];
            ny[i] = y[j];
            j++;
        }
        x = nx;
        y = ny;
    }
153722
def _scatter(sequence, n):
  """"""
  chunklen = int(math.ceil(float(len(sequence)) / float(n)))

  return [
    sequence[ i*chunklen : (i+1)*chunklen ] for i in range(n)
  ]
614646
def slice(l,num_slices=None,slice_length=None,runts=True,random=False):
	
	if random:
		import random
		random.shuffle(l)
	if not num_slices and not slice_length: return l
	if not slice_length: slice_length=int(len(l)/num_slices)
	newlist=[l[i:i+slice_length] for i in range(0, len(l), slice_length)]
	if runts: return newlist
	return [lx for lx in newlist if len(lx)==slice_length]
1263771
def cleanup(first_I, first_Z):
    
    cont = 0
    Nmin = len(first_I)
    if len(first_Z) < Nmin:
        Nmin = len(first_Z)
    for kk in range(Nmin):
        if first_I[kk][0] != first_Z[kk][0]:
            print("\n WARNING: ")
            if first_I[kk] < first_Z[kk]:
                del first_I[kk]
            else:
                del first_Z[kk]
            print("Unmatched step number: ", kk + 1, '  ignored')
            cont = 1
        if cont == 1:
            return first_I, first_Z, cont
    return first_I, first_Z, cont
634485
public static void removeFromList(List<String> list, String value) {
        int foundIndex = -1;
        int i = 0;
        for (String id : list) {
            if (id.equalsIgnoreCase(value)) {
                foundIndex = i;
                break;
            }
            i++;
        }
        if (foundIndex != -1) {
            list.remove(foundIndex);
        }
    }
231430
public static <E> ImmutableList<E> shuffledCopy(List<? extends E> list, Random rng) {
    final ArrayList<E> shuffled = Lists.newArrayList(list);
    Collections.shuffle(shuffled, rng);
    return ImmutableList.copyOf(shuffled);
  }
1308513
def delete(self, s, p, o):
        """"""
        with self.walrus.atomic():
            for key in self.keys_for_values(s, p, o):
                del self._z[key]
863231
public static Matrix3D random(int M, int N, int K) {
        Matrix3D A = new Matrix3D(M, N, K);
        for (int i = 0; i < M; i++)
            for (int j = 0; j < N; j++)
            	for (int l = 0; l < K; l++)
            		A.data[i][j][l] = Math.random();
        return A;
    }
1115747
function random$1(data, K) {
                const rand = new Picker$1(data);
                var ans = new Array(K);

                for (var i = 0; i < K; ++i) {
                    ans[i] = rand.pick();
                }
                return ans;
            }
699156
def listsdelete(x, xs):
    """"""
    i = xs.index(x)
    return xs[:i] + xs[(i+1):]
447871
function getRandomArray (n) {
  var res, next;

  if (n === 0) { return []; }
  if (n === 1) { return [0]; }

  res = getRandomArray(n - 1);
  next = Math.floor(Math.random() * n);
  res.splice(next, 0, n - 1);   // Add n-1 at a random position in the array

  return res;
}
1352614
public static List<double[]> generatekMeansPlusPlusCentroids(int k,
			List<double[]> input, Random random) {
		int n = input.size();
		assert (n > 0);
		int d = input.get(0).length - 1;
		assert (k <= n);

		List<double[]> centerValue = new ArrayList<double[]>(k);
		// Selects and copies the first centroid
		double[] lastCenter = new double[d];
		System.arraycopy(input.get(random.nextInt(n)), 1, lastCenter, 0, d);
		centerValue.add(lastCenter);

		double[] distance = new double[n];
		for (int j = 0; j < n; j++) {
			distance[j] = Double.POSITIVE_INFINITY;
		}
		for (int i = 1; i < k; i++) {
			// Selects the next centroid
			double sum = 0.0;
			Iterator<double[]> jIter = input.iterator();
			for (int j = 0; j < n; j++) {
				double[] point = jIter.next();
				distance[j] = Math
						.min(distance[j],
								point[0]
										* Metric.distanceSquared(lastCenter,
												point, 1));
				sum += distance[j];

			}
			int candidate = 0;
			if (sum > 0) {
				double nextCenterValue = sum * random.nextDouble();
				double currentValue = distance[0];
				while (!(nextCenterValue < currentValue)) {
					currentValue += distance[++candidate];
				}
			}
			// Copies the selected centroid
			lastCenter = new double[d];
			System.arraycopy(input.get(candidate), 1, lastCenter, 0, d);
			centerValue.add(lastCenter);
		}

		return centerValue;
	}