code: def generateHOSequence(sequence, symbolsPerSequence, numColumns, sparsity):
    
    sequenceHO = []
    sparseCols = int(numColumns * sparsity)
    for symbol in range(symbolsPerSequence):
      if symbol == 0 or symbol == (symbolsPerSequence - 1):
        sequenceHO.append(generateRandomSymbol(numColumns, sparseCols))
      else:
        sequenceHO.append(sequence[symbol])
    return sequenceHO
docs: Generates a high-order sequence by taking an initial sequence and the changing
    its first and last SDRs by random SDRs
    
    @param sequence (array) sequence to be randomized
    @param symbolsPerSequence (int) number of symbols per sequence
    @param numColumns (int) number of columns in the TM
    @param sparsity (float) percentage of sparsity  
    @return randomizedSequence (array) sequence that contains p percentage of new SDRs