generate-alt-random: DECGRI: random repeat lengths

This commit is contained in:
Daniel Eklöf 2021-03-09 11:37:47 +01:00
parent 660a7f9345
commit 8ba455f70e
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -206,7 +206,11 @@ def main():
for col in range(six_width):
out.write(f'{random.choice(sixels)}')
else:
out.write(f'!{six_width}{random.choice(sixels)}')
pix_left = six_width
while pix_left > 0:
pix_count = random.randrange(pix_left + 1)
out.write(f'!{pix_count}{random.choice(sixels)}')
pix_left -= pix_count
# Next line
if band + 1 < band_count: