def chooseCellsToLearnFrom(self, c,i,s, n, timeStep):
    """Choose n random cells to learn from.

    Returns tuples of (column index, cell index).
    """

    if n <= 0:
      return []

    tmpCandidates = [] # tmp because we'll refine just below with activeSynapses

    if timeStep == 't-1':
      tmpCandidates = numpy.where(self.learnState['t-1'] == 1)
    else:
      tmpCandidates = numpy.where(self.learnState['t'] == 1)

    # Candidates can be empty at this point, in which case we return
    # an empty segment list. adaptSegments will do nothing when getting
    # that list.
    if len(tmpCandidates[0]) == 0:
      return []

    if s is None: # new segment
      cands = [syn for syn in zip(tmpCandidates[0], tmpCandidates[1])]
    else:
      # We exclude any synapse that is already in this segment.
      synapsesAlreadyInSegment = set((syn[0], syn[1]) for syn in s.syns)
      cands = [syn for syn in zip(tmpCandidates[0], tmpCandidates[1]) \
               if (syn[0], syn[1]) not in synapsesAlreadyInSegment]

    if n == 1: # so that we don't shuffle if only one is needed
      idx = self._random.getUInt32(len(cands))
      return [cands[idx]]  # col and cell idx in col

    # If we need more than one candidate
    self._random.getUInt32(10) # this required to line RNG with C++ (??)
    indices = array([j for j in range(len(cands))], dtype='uint32')
    tmp = zeros(min(n, len(indices)), dtype='uint32')
    self._random.getUInt32Sample(indices, tmp, True)
    return [cands[j] for j in tmp]
Choose n random cells to learn from.

    Returns tuples of (column index, cell index).