def generateRandomInput(numRecords, elemSize=400, numSet=42):
 inputs = []
 for _ in xrange(numRecords):
  input = np.zeros(elemSize, dtype=realDType)
  for _ in range(0, numSet):
   ind = np.random.random_integers(0, (elemSize - 1), 1)[0]
   input[ind] = 1
  while (abs((input.sum() - numSet)) > 0.1):
   ind = np.random.random_integers(0, (elemSize - 1), 1)[0]
   input[ind] = 1
  inputs.append(input)
 return inputs

def generateRandomInput ( numRecords , elemSize = 400 , numSet = 42 ) : inputs = [ ] for _ in xrange ( numRecords ) : input = np . zeros ( elemSize , dtype = realDType ) for _ in range ( 0 , numSet ) : ind = np . random . random_integers ( 0 , ( elemSize - 1 ) , 1 ) [ 0 ] input [ ind ] = 1 while ( abs ( ( input . sum ( ) - numSet ) ) > 0.1 ) : ind = np . random . random_integers ( 0 , ( elemSize - 1 ) , 1 ) [ 0 ] input [ ind ] = 1 inputs . append ( input ) return inputs
generates a set of input record params: numrecords - how many records to generate elemsize - the size of each record numset - how many 1s in each record returns: a list of inputs .