def generateVectors(numVectors=100, length=500, activity=50):
 vectors = []
 coinc = numpy.zeros(length, dtype='int32')
 indexList = range(length)
 for i in xrange(numVectors):
  coinc[:] = 0
  coinc[random.sample(indexList, activity)] = 1
  vectors.append(coinc.copy())
 return vectors

def generateVectors ( numVectors = 100 , length = 500 , activity = 50 ) : vectors = [ ] coinc = numpy . zeros ( length , dtype = 'int32' ) indexList = range ( length ) for i in xrange ( numVectors ) : coinc [ : ] = 0 coinc [ random . sample ( indexList , activity ) ] = 1 vectors . append ( coinc . copy ( ) ) return vectors
generate a list of random sparse distributed vectors .