general function randSequence added