A long string of 1s and 0s cause the DC level of the transmission line to wander off. The phenominon is called "DC Wandering".
Due to Capacitance of the line, the DClevel is removed and the signal may start becoming BiPolar instead of remaining unipolar.
So the best solution is to use BiPolar signals during transmission. The PCM code to be transmitted is encoded in different manners befor it is put on the line. Viz. Manchester encoding, Miller's Encoding, BiPolar Return to Zero, BiPolar Non Return to Zero, Uniopolar NRZ, Unipolar RZ etc.
These prevent DC level of the signals from wandering and halps in clock recovery at the receiver.
Refer the book "Advanced Electonic Communication Systems" or "Electronic Communication Systems-Fundamentals through Advanced" both by Wayne Tomasi. Or any other book on the topic.
For scrambling for data security, the data is almost always first compressed to remove patterns and then is encrypted. Encryption has a certain element of randomness. In case of a public key-private key encryption, each data to be encrypted is encrypted by a symmetric key. This key is randomly generated and the cipher text of the same data encrypted twice is different.
Does this solve your problem?