code: def _generatePattern(self, numBits, totalSize):
      
      cellsIndices = range(totalSize)
      random.shuffle(cellsIndices)
      return set(cellsIndices[:numBits])
docs: Generates a random SDR with specified number of bits and total size.