@classmethod<EOL><INDENT>def _leastUsedCell(cls, random, cells, connections):<DEDENT>
leastUsedCells = []<EOL>minNumSegments = float("<STR_LIT>")<EOL>for cell in cells:<EOL><INDENT>numSegments = connections.numSegments(cell)<EOL>if numSegments < minNumSegments:<EOL><INDENT>minNumSegments = numSegments<EOL>leastUsedCells = []<EOL><DEDENT>if numSegments == minNumSegments:<EOL><INDENT>leastUsedCells.append(cell)<EOL><DEDENT><DEDENT>i = random.getUInt32(len(leastUsedCells))<EOL>return leastUsedCells[i]<EOL>
Gets the cell with the smallest number of segments.
Break ties randomly.

:param random: (Object)
Random number generator. Gets mutated.

:param cells: (list)
Indices of cells.

:param connections: (Object)
Connections instance for the TM.

:returns: (int) Cell index.