标签:python
打乱了,找线索,拼起来,再背。
import random s = ''' However, even NRZI can have long series of zeros (or ones if transitioning on "zero"), and thus clock recovery can be difficult unless some form of run length limited (RLL) coding is used in addition to NRZI. Magnetic disk and tape storage devices generally use fixed-rate RLL codes, while USB uses bit stuffing, which inserts an additional 0 bit after 6 consecutive 1 bits, thus forcing a transition. While bit stuffing is efficient, it results in a variable data rate because it takes slightly longer to send a long string of 1 bits than it does to send a long string of 0 bits. ''' ss = s.split() text = [] while ss: r = random.randint( 4, 7 ) t = reduce( lambda x, y : x + " " +y, ss[:r] ) if random.random() < 0.3: choice = random.choice( ss[:r] ) p = random.randint( 1, len( choice ) ) t = t.replace( choice, "*" + choice[p:] + choice[:p] ) text.append( t ) ss = ss[r:] random.shuffle( text ) for t in text: print " " * random.randint( 0, 15 ), t print
标签:python
原文地址:http://blog.csdn.net/pandora_madara/article/details/39315795