Pattern scrambler