def genblock(seed, length, step=1024, generator=random):
 if (seed is not None):
  generator.seed(seed)
 randint = generator.randint
 if ((length < step) or (step < 2)):
  step = length
 blocks = bytes()
 for i in range(0, length, step):
  blocks += bytes((randint(0, 255) for x in range(step)))
 return blocks

def genblock ( seed , length , step = 1024 , generator = random ) : if ( seed is not None ) : generator . seed ( seed ) randint = generator . randint if ( ( length < step ) or ( step < 2 ) ) : step = length blocks = bytes ( ) for i in range ( 0 , length , step ) : blocks += bytes ( ( randint ( 0 , 255 ) for x in range ( step ) ) ) return blocks
length-byte stream of random data from a seed .